Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Using Contrail Insights APIs

 

Contrail Insights APIs

Contrail Insights exposes a set of APIs for users to perform operations on the Contrail Insights Platform as needed. These APIs are published by Contrail Insights on a Swagger UI page. Users can access this UI through the Contrail Insights Dashboard to view and access Contrail Insights APIs. From the top right of the Contrail Insights Dashboard, select Settings > API Documentation to view the links to the Swagger UI for Contrail Insights APIs.

Prerequisites for API Usage

Contrail Insights APIs require authentication by means of the headers: X-Auth-Type and X-Auth-Token. These two values are available on the Contrail Insights Dashboard page. See Figure 1.

To configure authentication for Contrail Insights APIs:

  1. Open the Contrail Insights Dashboard in a Web browser. For example:
    http://<contrail-insights-platform-hostname>:<port>/appformix/#/settings/api_docs
    Figure 1: Required Authentication Headers for contrail-insights APIs: X-Auth-Type and X-Auth-Token
    Required
Authentication Headers for contrail-insights APIs: X-Auth-Type and
X-Auth-Token
  2. Select Link to AppFormix Documentation from the Dashboard page to view the main Contrail Insights Platform APIs.

    Select Link to AppFormix Analytics Documentation to view the Analytics APIs.

Example of using Contrail Insights APIs

The following steps demonstrate POST and GET calls on the /aggregatesContrail Insights API by means of Swagger. Similar actions can be done on other APIs.

POST /aggregates

  1. This REST call creates a new aggregate on Contrail Insights. Click the POST /aggregates section in the Swagger UI to view the required fields for this POST call.
  2. Use the following example headers and body required to create a new aggregate.
  3. Enter the above information for POST /aggregates API, then click Try it out! This action creates a new aggregate named demo-host-aggregate on Contrail Insights. Refer to Figure 2.Note

    To populate the text area with all the relevant fields, click Model Schema and then on the snippet below it.

    Figure 2: Create New Aggregate with POST /aggregates API Call
    Create New Aggregate
with POST /aggregates API Call

GET /aggregates

This REST call lists all of the aggregates present on the Contrail Insights Platform. To verify if the new aggregate from the above POST call is created successfully, provide headers for GET /aggregates API in the Swagger UI, then click Try it out! The output displays the new aggregate details. See Figure 3.

Figure 3: Verify New Aggregate with GET /aggregates API Call
Verify New Aggregate with
GET /aggregates API Call