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¶
-
grant_type
(string) : The grant type applicable to the token. By default, it is set at "client_credentials". Example:client_credentials
-
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
-
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¶
access_token
(string): The access token provided by the API for accessing OAuth 2 based APIs from Mappls. Example:0XXXXXXf-dXX0-4XX0-8XXa-eXXXXXXXXXX6
token_type
(string): Type of the token returned by the API. Example:bearer
expires_in
(number): period in seconds from generation after which the token generated will expire. Example:86499
scope
(string): The scope of the token applicable. Example:READ
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
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¶
- 200: To denote a successful API call.
- 204: To denote the API was a success but no results were found.
Client-Side Issues¶
- 400: Bad Request, User made an error while creating a valid request.
- 401: Unauthorized, Some extra invalid authorization object is being used to send a request.
- 403: Forbidden.
Server-Side Issues¶
- 500: Internal Server Error, the request caused an error in our systems.
- 503: Service Unavailable, during our maintenance break or server downtimes.
Response Messages (as HTTP response messages)¶
- 200: Success.
- 201: Created.
- 204: No matches were found for the provided query.
- 400: Something’s just not right with the request.
- 401: Unauthorized.
- 403: Forbidden.
- 500: Something went wrong.
- 503: Maintenance Break.
- 410 : Deleted
- 422 : Unprocessable entity
- 412 : Precondition Failed
- 428 : Precondition Required.
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!