Getting started

Provides information on getting started with using the APIs.

Leave Feedback

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:

  1. Install a custom integration to obtain the tenant ID, key, and secret.
  2. 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.

  1. From the console, elect All Clients and a client.
  2. Select Setup > Integrations > Integrations.
  3. From Available Integrations, select Other > Custom Integration, provide the following parameters, and click Install.
    • Name
    • Description
    • Category: Custom
  4. (Required) For Inbound parameters, specify Authentication Type as OAUTH2 and Save.
  5. Capture Tenant Id, Key, and Secret items. These items are used to generate the OAuth 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.opsramp.com/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.opsramp.com/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