Generate an access token

To generate an access token 4 pieces of information is needed:

  1. client id: Your credentials as an integrator, used for all Next Project instances you create integrations for. (client_id in example below)
  2. client secret: Your credentials as an integrator, used for all Next Project instances you create integrations for. (client_secret in example below)
  3. Next Project customer number: The Next Project instance are you creating an integration for. (next_database_number in the example below)
  4. One time key: Used to authenticate the integration for the Next Project instance. Created in the Prerequisite step by the integrator: https://next-tech.readme.io/docs/getting-started (your_one_time_api_key in the example below)

This token can be used for further interaction with the API. Access tokens are created by using the https://next-tech.readme.io/reference/login_token_post endpoint.

With the information above it looks like this:

Same example in Curl:

curl -X 'POST' \
  'https://api.next-tech.com/v1/token' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&username=next_database_number&password=your_one_time_api_key&scope=&client_id=client_id&client_secret=client_secret'

In response to the above request, you will receive a JSON object containing the access token.

{  
  "access_token": "5109d8fc-aade-46ea-a355-2d707ba16b82",  
  "token_type": "bearer"  
}

That token shall be included as an authorization header in all requests to the API as demonstrated in the curl command below.

curl -X 'GET' \
  'https://api.next-tech.com/v1/project/?page=1&size=50' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer 5109d8fc-aade-46ea-a355-2d707ba16b82'

An access token has no maximum lifetime but it can be revoked by deleting the API Key in Next. If you lose the token or if it is disabled, a new token must be created from Next as described above.