Introduction
API requests require the following
- Client Id
- Client Key
- Client Secret
- Access token URL - URL of the API server used to generated the access token.
Example:
https://{api_server_url}/auth/oauth/token
Generating OAuth 2.0 access token is a two-step process:
- Install a custom integration to obtain the tenant ID, key, and secret.
- Issue a cURL command (with the OAuth key and secret) to obtain the OAUTH access token.
Step 1: Install custom integration
In the following steps, you install a custom integration in order to obtain the OAuth Key and Secret.
- From the console, select All Clients and a client.
- Select Setup > Integrations > Integrations.
- From Available Integrations, select Other > Custom Integration,
provide the following parameters, and click Install.
- Name
- Description
- Category: Custom
- (Required) For Inbound parameters, specify Authentication Type as
OAUTH2
and Save. - Capture
Tenant Id
,Key
, andSecret
items. These items are used to generate the OAuth access token.
Token Validity Period
The validity period of the access token is 2 hours. If the token expires, regenerate the access token.Step 2: Get an access token
The following cURL sample shows the syntax for retrieving the OAuth access token.
curl -k https://{api-url}/auth/oauth/token
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
-d "grant_type=client_credentials&client_id={Key}&client_secret={Secret}"
-X POST
The following cURL sample gets the access token for URL
, api-2adc3
.
curl https://api-2adc3.vistanet.jp/auth/oauth/token
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
-d "grant_type=client_credentials&client_id={Key}&client_secret={Secret}"
-X POST
Step 3: Test an API call
The following cURL sample posts the incident data for URL, api-2adc3
.
curl https://api-2adc3.vistanet.jp/api/v2/tenants/{tenantId}/incidents
-H "Authorization: Bearer {access Token}"
-H "Content-Type: application/json"
-H "Accept:application/json"
-d {"subject":"TestSubject","description":"TestDescription","priority":"Very Low"}
-X POST