Skip to content

Quickstart

Barnaby Alter edited this page Jan 22, 2018 · 3 revisions

Request an access token

In order to use the Salon application you need to be authorized by the Libraries Login OAuth2 application. Read the CONTRACT to learn more about it, or skip below for the TL;DR version.

Request

#!/bin/sh

CLIENT_ID='{MY_ID}'
CLIENT_SECRET='{SHHHH}'

curl -X POST \
  -d grant_type=client_credentials \
  -d client_id=$CLIENT_ID \
  -d client_secret=$CLIENT_SECRET \
  https://dev.login.library.nyu.edu/oauth/token -v

Response

{
    "access_token": "ACCESS_TOKEN_FOR_THIS_SESSION",
    "created_at": 1234567890,
    "expires_in": 7200,
    "token_type": "bearer"
}

Use the access token to mint a new URL identifier

Once you have the access token from Login, you can use that to access the API. Or use the examples below to create new empty resources:

Request

#!/bin/sh

curl -H "Content-Type: application/json" \
  -H "Authorization: Bearer ACCESS_TOKEN_FOR_THIS_SESSION" \
   -X POST \
  https://persistent.library.nyu.edu/create_empty_resource -v

Response

{
  "id": "NEWLY_MINTED_UNIQUE_ID"
}
Clone this wiki locally