V2 Get Token REST Service for Basic 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 the V2 REST services. The token is valid for date/time available in the response.

Request Format

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: Basic XXXXXXX'

Response Format

A JSON object is returned in the following format:

{

"data": [],

"message": [],

"status": <REST status code value>,

}

Sample Success Response

This is an example of a successful response to a request.

{

"data": {

"expiryDate": "30/09/2023",

"Timezone": "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",

"access_token": "eyJ0eXAiOiJEQiJ9.eyJ1c2VybmFtZSI6IiQkbW9oYW5kMzIifQ==.6CCC9E5E-9266-E154-59F2-DB861A6C7142205367E35B6B058F4B6A03BD6E4BD814",

"auth_type": "Basic",

"expiryTime": "30/09/2023 08:20 PM",

"expires_in": 172800

},

"message": [],

"status": 200

}

Supported Response Parameters for Basic Authentication

For basic authentication, the following parameters display 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.

expiryDate

string

Displays the expiry date formatted in accordance to the integration user's timezone.

Timezone

string

Displays the integration user's timezone.

auth_type

string

Displays the authentication type used by the integration user. Choices include: Basic, and OAuth.

expiryTime

string

Displays the expiry time formatted in accordance to the integration user's timezone.

message

string

Displays the error message.

status

string

Displays the http status code.

Supported Validation Messages and Status Codes

The following HTTP status codes are supported for this REST service:

HTTP Status Code

Status Message

Error Message

200

Sucess

not applicable.

400

Bad Request

Invalid expiry.

401

Unauthorized

Empty or Invalid Authorization Header.

Invalid Authorization Header

500

Internal Server Error

Please contact Administator with Diagnostic code.

Related Topics

Setting Up Integration Users with Basic Authentication

V1 Get Token REST Service for Basic Authentication



Last Published Tuesday, July 1, 2025