Utilizing the Inspire Open API for Custom Reports

Inspire has the ability to access various endpoints (REST APIs) by making an http request. In order to make this request you will need first generate a set of credentials and exchange those credentials for token before requesting data from an endpoint.

This article covers:
- Enabling the Open API within your Inspire instance
- Using generated credentials to get an access token
- Using the access token to make an http request to an Inspire endpoint

Pre-requisites:
- You will need to be an admin to enable the Open API integration

Enabling the Open API within your Inspire instance:


Navigation
Within Inspire, navigate to Administration > Admin > Settings > Integrations

You will notice a section called "Applications". This is where you will add a new Open API integration.

Click the "Add" button

Fill out the dialog with a name and description. Generally, this will be the name of the application or process that will access the Open API. It is only for your reference. The Client ID and Client Secret will be pre-generated for you and cannot be changed once it generated. If you need generate a new Client ID and Client Secret, you can always add another Application. Keep in mind if you delete an existing Application, the associated Client ID and Client Secret will no longer be valid and any existing clients will need to be updated to a current Client ID and Client Secret to continue to access related data.

You may access the Client ID and Client Secret values for an existing application at any time by clicking the associated edit icon. Form the open dialog, you may click the copy icon to copy the related value to your clipboard.

Using generated credentials to get an access token:
In order to make requests to Inspire's Open API, you will first need to make a request for a token with the generated Client ID and Client Secret.

HTTP Verb: POST
URL: https://app.inspiresoftware.com/api/oauth/token
Header: Content-Type: application/x-www-form-urlencoded
Body (application/x-www-form-urlencoded):
grant_type: client_credentials
client_id: {CLIENT_ID}
client_secret: {CLIENT_SECRET}

A successful call to this endpoint will result in a status code of 200 with a response like:
{
      "access_token":"{SOME_VALID_JWT}"
      ,"token_type":"bearer"
      ,"expires_in":3599 (approximately one hour)
}

An unsuccessful call to this endpoint will result in a status code of 400 with a response like (or similar):
{
      "error":"invalid_credentials"
      ,"error_description":"A valid client_id and client_secret must be provided"
}

Using the access token to make an http request to an Inspire endpoint:


Inspire currently exposes a single enpoint for open API access:
Base URL:  https://app.inspiresoftware.com
Endpoint: /api/public/externalcustomreport/GetCustomReportData?customReportKey={REPORT_KEY}&pageSize={PAGE_SIZE}&pageNumber={PAGE_NUMBER}

This endpoint can be accessed as follows:
HTTP VERB: GET
URL: BASE URL/api/public/externalcustomreport/GetCustomReportData
Header: Authorization: "Bearer {SOME_VALID_JWT}"
Params: customReportKey, pageSize, pageNumber