This topic describes how to add an OpenAPI Explorer data source in DataV. OpenAPI Explorer provided by Alibaba Cloud allows you to call API operations of cloud products for easy query and control. In DataV, OpenAPI Explorer is often used to call API operations of other Alibaba Cloud products to obtain and display data.

  1. Log on to the DataV console.
  2. Click the Data Sources tab and then Add Source.
  3. Select Open API from the Type drop-down list.
  4. Enter OpenAPI Explorer information.
    Add an OpenAPI Explorer data source
    Parameter Description
    Name The name that you want to display for the data source.
    EndPoint The endpoint of OpenAPI Explorer. You can obtain this information from the API documentation of the related cloud product. For example, the endpoint of OpenAPI Explorer for ECS is ecs.aliyuncs.com, and the endpoint of OpenAPI Explorer for CloudMonitor in the China (Hangzhou) region is metrics.cn-hangzhou.aliyuncs.com.
    APIVersion The API version of a cloud product. You can obtain this information from the API documentation of the related cloud product. For example, the API version for CloudMonitor is 2017-03-01.
    AppKey The AccessKey ID of the account that has permissions to call API operations by using OpenAPI Explorer.
    AppSecret The AccessKey secret of the account that has permissions to call API operations by using OpenAPI Explorer.
  5. After you enter the OpenAPI Explorer information, click OK.

    The added data source is displayed in the data source list.

Use the OpenAPI Explorer data source

  1. Log on to the DataV console.
  2. On the Projects tab, move the pointer over the project that you want to edit and click Edit.
  3. On the edit page of the canvas, click a widget.

    If no widget is added to the canvas, add a widget first. For more information, see Add a widget.

  4. In the right-side configuration pane, click the Data tab and then Set.
    Set Data Source
  5. In the Set Data Source pane, select Open API from the Data Source Type drop-down list.
  6. In the Select Data Source section, select the configured Open API data source.
  7. Specify Interface Name.

    Enter the name of the API operation that you want to call. The operation name is the value of the Action parameter that you specify to call the operation. You can obtain the value from the API operation list of the related cloud product, such as QueryMetricList for CloudMonitor.

  8. Optional:Enter Path of Responses.

    Use part of the results returned by OpenAPI Explorer as the value of this parameter.

    The following example shows the results returned by OpenAPI Explorer:
    {
        "data": [
            {
                "x": 1,
                "y": 2
            },
            {
                "x": 2,
                "y": 4
            }
        ]
    }
    If you enter data in Path of Responses, the response results are as follows:
    [
        {
            "x": 1,
            "y": 2
        },
        {
            "x": 2,
            "y": 4
        }
    ]
    Note This conversion can be performed by using the filter. The Path of Responses parameter can be left blank.
  9. Enter query parameters in the edit box under the Path of Responses parameter.
    • The query parameters are OpenAPI Explorer parameters, which are configured as JSON objects.
    • For more information about the parameter names, see the descriptions of the input parameters in the API documentation of the related cloud product.
    • Enter the callback ID in the value of a JSON object.
    The following example shows the query parameters of the API operation QueryMetricList for CloudMonitor.
    // Use the callback ID myInstanceId.
                {
                  "Period": 600,
                  "StartTime": "2018-11-20 11:30:00",
                  "EndTime": "2018-11-21 11:30:00",
                  "Metric": "cpu_idle",
                  "Project": "acs_ecs_dashboard",
                  "Dimensions": "{instanceId:':myInstanceId'}"
                }
  10. Click Preview Data Response to view the returned data.