Data Source API

This article provides sample API calls for Data Sources in Metric Insights.

You can use the following Item functions:

  1. data_source (to fetch a list of Data Sources and their metadata)
  2. data_source_sql (to create, delete, edit SQL Data Sources and obtain a list of SQL Data Sources)
  3. data_source_plugin (to obtain a list of Plugin Data Sources)
  4. data_source_parameter (to query Parameters used for a particular Plugin Data Source)
  5. data_source_external_report (to obtain a list of External Reports for a particular Plugin Data Source)

PREREQUISITES:

  1. Set up API access
  2. Verify that you have API access
  3. Obtain a token via a get token call since all API calls require a token
Obtain a list of all Data Sources
  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: from the dropdown, select data_source
  3. Methods: GET
  4. Run request: click to get a list of all Data Sources and their metadata

Raw response will contain information about Data Sources in Metric Insights.

Obtain a List of SQL Data Sources
  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: from the dropdown, select data_source_sql
  3. Methods: GET
  4. Run request: click to get a list of all SQL Data Sources and their metadata

Raw response will contain information about SQL Data Sources in Metric Insights.

Obtain a list of Plugin Data Sources
  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: from the dropdown, select data_source_plugin
  3. Methods: GET
  4. Run request: click to get a list of all Plugin Data Sources and their metadata

Raw response will contain information about Plugin Data Sources in Metric Insights.

1. Create a Data Source (applicable to SQL Data Sources)

You can use any of the available Data Sources as a model for a new Data Source.

The example provided below shows how create a new Data Source from an existing Data Source.

Currently creating and editing options are supported for SQL Data Sources only.

  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: select data_source_sql
  3. Methods: choose POST
  4. ID: input the ID of an existing Data Source that will be used to build a new Data Source
    • After you input the Data Source ID, the Request field will display the settings for that Data Source
  5. Request:
    • If you want to make a copy of an existing Data Source, input a meaningful Name and Password and keep the rest of the settings as they are
    • In case you want to use an existing Data Source as a model and query data from your own database, additionally input connection parameters that are relevant to you
  6. Run request: click to create a new Data SourceAsok

Raw response will contain the new Data Source settings.

The newly created Data Source will be assigned an ID that can be used to Test Connection during a subsequent API call.

2. Test Connection (applicable to SQL Data Sources)

  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: select data_source_sql
  3. Methods: PUT is used
  4. ID: input the ID of the Data Source whose connection will be tested
  5. Actions: from the dropdown, select Test Connection
  6. Run request: click to run the API action call

If the call is successful, the Raw response will display "status: OK" message

3. Obtain a list of Data Source Parameters (applicable to Plugin Data Sources)

  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: select data_source_parameter
  3. Methods: GET is used
  4. Profile: input the ID of the Data Source (connection profile) whose connection will be tested
  5. Run request: click to query a list of Data Source Parameters

Raw response will contain information about Parameters for the specified Data Source.

4. Query a list of External Reports (applicable to Plugin Data Sources)

  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: select data_source_external_report
  3. Methods: GET is used
  4. Profile: input the ID of the Data Source (connection profile) whose connection will be tested
  5. Run request: click to query a list of External Reports (Data Source Objects)

Raw response will contain information about External Reports for that Data Source.

5. Refresh List (applicable to Plugin Data Sources)

  1. Token: enter the Token that you have previously obtained as noted in the PREREQUISITES
  2. Item: select data_source_plugin
  3. Methods: PUT is used
  4. Actions: select Refresh List
  5. Run request: click to make an API action call

If the call is successful, the Raw response field will be empty. Otherwise, an error message will be displayed.