V2 Get Token REST Service for OAuth Authentication
GET https://<hostname>/ws/rest/service/v2/auth/token
Purpose
Use this rest service with your credentials to fetch a JWT token to access V2 REST services. The token is valid for date/time available in the response. The token expiration is set to 3600 seconds by default.
Sample Request
Send an API request for a token with the end point URL included in the following curl command.
curl --location --request GET 'http://<HOST_NAME/ws/rest/service/v2/auth/token' \
--header 'Authorization: Bearer XXXXXXX'
Note: If the endpoint URL has a project number that contains special characters such as / \ : * ? " < > or |, you must change those special characters to URL escape characters. For example, a project number with a special number sign (hash) such as 2020#7 must be changed to 2020%7. You can use a browser to access the list of URL escape characters.
Optional Request Parameter
Use the following parameter to modify the token expiration in the API request:
Request Parameter | Data Type | Description |
---|---|---|
expiry | string | Enter the optional token expiration duration in seconds. For example, expiry=300. |
Sample Success Response
{
"data": {
"endpoint": "rest1",
"access_token": "eyJ4NXQjUzI1NiI6ImhwYnAxMFpETU9mUUp3VzI4TnE4OU8tUVpoR19ZSDBPS1kwNHdyZTBtVjQiLCJ4NXQiOiJjTWxIdUZvTEZNdjdGWHRQbGlVNlZBQWdoLTQiLCJraWQiOiJTSUdOSU5HX0tFWSIsImFsZyI6IlJTMjU2In0.eyJjbGllbnRfb2NpZCI6Im9jaWQxLmRvbWFpbmFwcC5vYzEuaWFkLmFtYWFhYWFhYXF0cDViYWFmZnRoY2N0ZG5sZ2k3bnpjNnN2bjU0Ym40N2xpZXVnbzNsanJoY25ycGNucSIsInVzZXJfdHoiOiJBbWVyaWNhXC9Mb3NfQW5nZWxlcyIsInN1YiI6InZlbmthbm5hLmpha2thK3N0YWJsZTNkcnNAb3JhY2xlLmNvbSIsInVzZXJfbG9jYWxlIjoiZW4iLCJzaWRsZSI6NDgwLCJ1c2VyLnRlbmFudC5uYW1lIjoiaWRjcy0wNWQ0YWJlZmZlODA0N2M5OTY4ZTZjYThjYjk2NWQzMyIsImlzcyI6Imh0dHBzOlwvXC9pZGVudGl0eS5vcmFjbGVjbG91ZC5jb21cLyIsImRvbWFpbl9ob21lIj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8xaeXteHYEba0e8yttldeC6yjsDHOfL9z99i7neeJjhuBHAvY3WfuZne_isnVGgKVQazY4OS01Yk4XeuHSu9OfKdRt_IJOmIgqrZGUmrEste3QzjbGhOB9zeZod6c2u-bX1ctHbiUyPUxkGYTYGKfzcnQN5IS3gi18jnyAuNRrTsbsvKOC6dSyOpWCZg4rg6CH0KXuN_X7B7amUeNxfG4S5Pm3kpg",
"expires_in": 3600,
"request_headers": {
"x-unifier-tenant-code": "tenant",
"x-unifier-tenant": "idcs-XXX"
}
},
"message": [],
"status": 200
}
Supported Response Parameters for OAuth Authentication
For OAuth authentication, the following parameters display with values in the response output:
Response Parameter | Data Type | Description |
---|---|---|
access_token | string | Displays the bearer token. |
expires_in | string | Displays the expiry duration in seconds. By default, 3600 seconds. |
endpoint | string | The end point for tenant REST calls. |
request_headers | string | Contains the following tenant information:
|
message | string | Displays the error message. |
status | string | Displays the http status code. |
Supported HTTP Status Codes
The following HTTP status codes are supported for this rest service:
HTTP Status Code | Status Message | Error Message |
---|---|---|
200 | Success | not applicable. |
400 | Bad Request | Invalid expiry. |
401 | Unauthorized | Empty or Invalid Authorization Header. Invalid Authorization Header |
500 | Internal Server Error | Please contact Administrator with Diagnostic code. |
Related Topics
Setting Up Integration Users with OAuth Authentication
V1 Get Token REST Service for OAuth Authentication
Last Published Tuesday, April 15, 2025