Examples¶
Here is an example of how to retrieve token details by ID.
Retrieve Token Details by ID¶
Request using the ‘curl’ command:
curl -X GET \
https://{HOST}/api/public/v3/access-tokens/TOKEN_1602946387 \
-H "Content-Type: application/json" \
-H "Token: 4202c0abe0abd84bf2ab16a717e071d950998ce1
Request using Java source code:
public void printAccessTokenInfo( String tokenId ) {
Client client = ClientBuilder.newClient();
WebTarget target =
client.target( MSP_URL ).path( "/api/public/v3.1/access-tokens" )
.queryParam( "id", tokenId );
Response response =
target.request().header( "token", MSP_TOKEN )
.get( Response.class );
if ( response.getStatus() == 200 ) {
System.out.println( response.readEntity( String.class ) );
} else {
System.out.println( response.readEntity( String.class ) );
}
client.close();
}
Response:
Status: 200
Response Body:
{
"expiresAt": "2019-02-02T12:33:44Z",
"issuedAt": "2019-01-21T15:33:03+05:30",
"issuedTo": "USR_123",
"userName": "user-name",
"applicationName": "MS-Portal",
"active": "true",
"revoked": "false",
"type": "UI"
"id": "TOKEN_1602946387",
"allowedIpRange": "11.2.0.0/11,100.0.2.45/30"
}
Parent topic:Retrieve Token Details