Validating the token

The TrueSight Web Service (TSWS) token API (GET) is meant for validating whether the user session identified by the authToken provided through the request is still active or not. The user session is created using the token API (POST). It uses the GET method to validate the token for the logged in user. 

TSWS APIs that use the GET method
API EndpointsDescription
devicesRetrieves a list of monitored devices
instances Retrieves a list of monitored instances 
monitortypesRetrieves a list of monitor types 
tenantsRetrieves a list of tenants 

Before you begin

You must have used the token API (POST) to obtain the authToken, which authenticates the user performing the operation. For details, see TSWS authentication.

Request syntax

https://<PresentationServerName>/tsws/api/v10.1/token

Request Header parameters

ParameterDescription
authToken

Value of the authToken

getTokenDetails

Set it to true or false. Setting it to true returns a response header when the request succeeds. Any value other than true is considered as false, and no details are returned in response.

Note: If the authToken value passed is Admin and the getTokenDetails is set to true, then the behavior is same as setting it to false.

Sample request with REST client

After accessing the REST client, perform the following steps:

  1. Enter the URL for the configuration data of monitor instances API. The generic format is:
    https://<Presentation Server host name>/tsws/api/v10.1/token
  2. Add a new header row and select authToken as the header type.
  3. Enter the text authToken followed by the authToken generated through the token API (POST). 
    The request body is blank.
  4. (Optional) Add a new header row, name it as getTokenDetails.
  5. Enter the text getTokenDetails followed by the value True.
  6. Click Send.

Sample JSON response

The response information follows the standard HTTP response status codes.

Sample JSON response for the validate token API:

Status codeDescriptionSample JSONTroubleshooting tips
200Success

Header when getTokenDetails is false or no details are returned in response:

{
  "responseTimeStamp": "2017-05-15T15:02:16",
  "statusCode": "200",
  "statusMsg": "OK"
}

Header response when getTokenDetails is true:

{
  "responseTimeStamp": "2017-05-15T15:02:16",
  "statusCode": "200",
  "statusMsg": "OK"
  {
	"response":
	{
		"tenantName:"*",
		"username":"admin"
	}		
}
Not applicable.
400Missing token
{
  "responseTimeStamp": "2017-05-15T15:02:16",
  "statusCode": "400",
  "statusMsg": "Token is missing"
}
Specify the authToken in the request header.
404Expired token
{
  "responseTimeStamp": "2017-05-15T15:02:16",
  "statusCode": "404",
  "statusMsg": "Token expired, timeout occurred"
}
Log in again using the token API (Post).

Related topics

Developing

Was this page helpful? Yes No Submitting... Thank you

Comments