Using Access Token in the header for further API calls
The access token retrieved using the get-service-token API can be used in the header for making further API calls.
In this section, as an example, we are using the access token with the API call for reissuing a certificate in the async mode.
Before you begin
- Access Token is obtained from the get-service-token API.
- Ensure that the Access Token is valid and has not expired.
Request Structure
| Endpoint: | /certificate/create |
| Type: | POST |
| Sample URL: | https://<IP/HostName/TenantName>:<GWPORT>/avxapi/resource?gwsource=externalTo understand the elements of the sample URL, click here. |
| Headers: | |
| Content-Type: | application/json |
- 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.
- IP: A unique identifier assigned to each device connected to
a computer network that uses the Internet Protocol for communication
- 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.
| Name | Description |
|---|---|
| Token
|
(Mandatory) Use token retrieved from
login API. Type: String Example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwbGF0Zm9y bSIsImF1ZCI6ImF2eCIsImNsaWVudElkIjoiOTcwNzRlNDEtOGFmOS00NTZkLTlhNjQtZjB jNGJiOTA4MDQ4IiwiaXNzIjoiYXZ4IiwiZXhwIjoxNjUwMzY5MzY3LCJncmFudCB0eXBlIj oiY2xpZW50X2NyZWRlbnRpYWxzIn0.HZnkuUEjXIeqJWqpqi NWFHqIDI7GYf4cWx 6VwbjGD_0 |
| gwsource
|
(Mandatory) Source from which the
request is triggered. The values can be:
Type: String |
| Payload
|
(Mandatory) Input data for request body in application/json format. For payload details, see Payload section. |
| Name | Description |
|---|---|
| name
|
(Mandatory) Name of the resource to create. Name cannot be
duplicated. Example: "resource_1" |
| description
|
(Optional) Description of the resource. Example: "This is a sample resource." |
Response Structure
- Status Code: 201 Created
- Message: Resource added successfully
- Headers:
- Content-Type: application/json
| Name | Description |
|---|---|
| response | Contains the response attributes for resource added successfully. |
| 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 |
|---|---|---|
| 201 Created | null | Resource added successfully |
| 409 Conflict | RBAC_RE_005 | Resource with the given name already exists |
| 400 Bad Request | VALIDATION_ERROR_0004 | 'name' should have at least '2' characters, Mandatory Field 'name' is missing or empty |
| 400 Bad Request | VALIDATION_ERROR_0004 | Invalid "name". |
| 401 Unauthorized | AVX_GW_012 | Unauthorized access, reason - Invalid Token |
| 407 Proxy Authentication Required | AVX_GW_011 | Session validation failed, reason - Session information is missing. |
Sample Request/Response
Add a resource using API with Access Token.
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/resource?gwsource=external{
"payload": {
"name": "resource_1",
"description": "This is a sample resource."
}
}{
"response": "Resource added successfully",
"message": "Resource added successfully",
"appStatusCode": null,
"tags": null,
"headers": null
}