Retrieve Access Token using get-service-token API

The API provides a streamlined process for retrieving service tokens related to account management tasks.

Before you begin

  • Make sure you have valid login credentials for accessing the system.

Request Structure

Endpoint: /acctmgmt-get-service-token
Type: POST
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/acctmgmt-get-service-token?gwsource=external

To understand the elements of the sample URL, click here.

Headers:
Content-Type: application/json
Authentication: Yes
Request timeout period 15 minutes
Table 1. Input Parameters
Description
Authorization

Header

(Mandatory) Please form a string in this format <Client ID>:<Client Secret> and do base64 encoding. Then prepend a key 'Basic' before the encoded value. Final value should be "Basic <EncodedValue>".

Type: String

Example: "admin"

Content-Type

Header

(Mandatory) The parameter should be set to application/json to specify the nature of the data in the payload.

Type: String

Example: "application/json"

grant_type

Payload

(Mandatory) Payload Type should be "Form". The value of the param should be "Client_Credentials".

Type: Text

Response Structure

  • Status Code: 200 Ok
  • Message: Successful
  • Headers:
    • Content-Type: application/json
Table 2. Response Parameters
Name Description
response The response contains the attributes needed to retrieve the access token.
message Success message or failure description in case of error.
appStatusCode Application specific status code for the response. Will be non-null for failure response.
tags More info in case of failure response.

Status Codes

HTTP Code appStatusCode Response Message
200 OK NA Successful
400 Bad request ACCT_SA_003 Service account is invalid/not found::[Service account not found in the database]
400 Bad request OAUTH_CLNT_015 Client Password is incorrect::[Invalid Client credential]
400 Bad request ACCT_SA_001 Invalid Request::[Invalid client Id or secret]
500 Internal Server Error avx-common-011 Error while processing.

Sample Request/Response

Use Case

Retrieve Access Token.

Request URL
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/acctmgmt-get-service-token?gwsource=external

Content-Type: application/x-www-form-urlencoded

Authorization: Basic NTIxYzNhZDItZWE0ZS00NDdiLWE1MWItOTYyMWJiN2VhMTI2OjU1QVUjTk84JSpaaGd2TmZhWVVtdHZYMGRrRWhvZGJpCg==

Request Payload
Sample Response
{ 
"response": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwbGF0Zm9ybSIsImF1ZCI6ImF2eCIsImNsaWVudElkIjoiOTcwNzRlNDEtOGFmOS00NTZkLTlhNjQtZjBj NGJiOTA4MDQ4IiwiaXNzIjoiYXZ4IiwiZXhwIjoxNjUwMzY5MzY3LCJncmFudCB0eXBlIjoiY2xpZW50X2NyZWRlbnRpYWxzIn0.HZnkuUEjXIeqJWqpqiNWFHqIDI7 GYf4cWx6VwbjGD_0", 
"message": null, 
"appStatusCode": null, 
"tags":{}, 
"headers": null 
}

What's Next

References

Understanding the sample URL
  • IP/HostName/TenantName: Replace with the actual IP address, hostname, or tenant name based on the specific configuration in AppViewX.
    • IP: A unique identifier assigned to each device connected to a computer network that uses the Internet Protocol for communication

      The IP address will be included in the endpoint URL for an on-prem deployment.

    • HostName: A human-readable label assigned to a device (host) on a network

      The hostname will be included in the endpoint URL for an on-prem deployment.

    • TenantName: An identifier label for a tenant given to indicate which tenant's data the API request will access/modify

      The tenant name will be included in the endpoint URL for a SaaS deployment.

  • GWPORT: AppViewX gateway port

    A gateway port refers to a network port through which data is sent and received to communicate with a gateway in an on-prem deployment.

    Example: 31443

  • avxapi: Path parameter value (static) that is part of the endpoint's URL
  • Endpoint: Endpoint of the API, for example: execute-hook
  • gwsource: Source or origin of a gateway, for example: external.