Skip to content

Token Generation API

Introduction

This API is required to generate tokens authorize the oAuth 2 based APIs. Hence, the developer would need to send a request for access token using their client_id and client_secret to the Token Generation API. Once validated from the OAuth API, the access_token and the token_type need to be sent as Authorization header with the value: {token_type} {access_token}

    Authorization: “token_type access_token”. 

Input URL

https://outpost.mappls.com/api/security/oauth/token

Method

POST

Request Type

Content-Type: application/x-www-form-urlencoded

Response Type

Content-Type: application/json

Request Body

Mandatory Parameters

  1. grant_type (string) : The grant type applicable to the token. By default, it is set at "client_credentials". Example:

    • client_credentials
  2. client_id (string) : The client ID provided to thec client for accessing oAuth 2 based APIs. There is no fixed length for client id. Example:

    • 33Okryxxxxxxxxxxxxxxx-yyyyyyyyyyyyyy-zzzzzzzzzzz
  3. client_secret (string) : The client secret provided to thec client for accessing oAuth 2 based APIs. There is no fixed length for client secret. Example:

    • lxxxxx-iyyyyyyyyyyyyyYYyyyy-ZzzZzzzz-3xyxyxyXYxyxy=

Response Parameters

  1. access_token(string): The access token provided by the API for accessing OAuth 2 based APIs from Mappls. Example:
    • 0XXXXXXf-dXX0-4XX0-8XXa-eXXXXXXXXXX6
  2. token_type (string): Type of the token returned by the API. Example:
    • bearer
  3. expires_in (number): period in seconds from generation after which the token generated will expire. Example:
    • 86499
  4. scope (string): The scope of the token applicable. Example:
    • READ
  5. project_code (string): The project code/ID for which the token was generated. This is helpful in identifying if there are multiple projects in an account of Mappls API console. Example:
    • prj1234567890987654321
  6. client_id (string): client ID which was used in generation of the token. In case there are multiple pairs of client ID + Client secret within a project, this will help in identifying which pair was used for generation of token. Example:
    • 33Okryxxxxxxxxxxxxxxx-yyyyyyyyyyyyyy-zzzzzzzzzzz

Sample cURL Request

curl --location --request POST 'https://outpost.mappls.com/api/security/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'User-Agent: iamdarkseid' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=33Okryxxxxxxxxxxxxxxx-yyyyyyyyyyyyyy-zzzzzzzzzzz' \
--data-urlencode 'client_secret=lxxxxx-iyyyyyyyyyyyyyYYyyyy-ZzzZzzzz-3xyxyxyXYxyxy='

Sample Response

{
  "access_token": "0XXXXXXf-dXX0-4XX0-8XXa-eXXXXXXXXXX6",
  "token_type": "bearer",
  "expires_in": 86499,
  "scope": "READ",
  "project_code": "prj1234567890987654321",
  "client_id": "33Okryxxxxxxxxxxxxxxx-yyyyyyyyyyyyyy-zzzzzzzzzzz"
}

Response Codes (as HTTP response codes)

Success

  1. 200: To denote a successful API call.
  2. 204: To denote the API was a success but no results were found.

Client-Side Issues

  1. 400: Bad Request, User made an error while creating a valid request.
  2. 401: Unauthorized, Some extra invalid authorization object is being used to send a request.
  3. 403: Forbidden.

Server-Side Issues

  1. 500: Internal Server Error, the request caused an error in our systems.
  2. 503: Service Unavailable, during our maintenance break or server downtimes.

Response Messages (as HTTP response messages)

  1. 200: Success.
  2. 201: Created.
  3. 204: No matches were found for the provided query.
  4. 400: Something’s just not right with the request.
  5. 401: Unauthorized.
  6. 403: Forbidden.
  7. 500: Something went wrong.
  8. 503: Maintenance Break.
  9. 410 : Deleted
  10. 422 : Unprocessable entity
  11. 412 : Precondition Failed
  12. 428 : Precondition Required.

For any queries and support, please contact:

Email us at apisupport@mappls.com

Support Need support? contact us!



@ Copyright 2022 CE Info Systems Ltd. All Rights Reserved.