QueryData
    • PDF

    QueryData

    • PDF

    Article summary

    Summary

    This API queries the time-series data collected by Cloud Insight.

    Request

    API URL

    URL: https://cw.apigw.ntruss.com/cw_fea/real/cw/api/data/query
    Method: POST
    

    Request header

    The request headers specified in common settings are required.

    Content-Type: application/json
    x-ncp-apigw-signature-v2: {generated signature}
    x-ncp-apigw-timestamp: {current timestamp}
    x-ncp-iam-access-key: {your iam access key}
    

    Request Body

    DataQueryRequest

    {
      "timeStart": "long",
      "timeEnd": "long",
      "cw_key": "string",
      "productName": "string",
      "metric": "string",
      "interval": "string",
      "aggregation": "string",  
      "queryAggregation": "string",
      "dimensions": {
          "string": "string",
          "string": "string"
      }
    }
    

    Reference:

    • aggregation refers to the aggregation function that is executed when data is streamed into the system before writing the data in the database.

    • It is necessary to match the aggregation function configured during the schema registration and the aggregation in the data query request since the user can't retrieve the data if they don't match.

    • The recommended query period (timeEnd - timeStart) varies, depending on the data aggregation interval. Refer to the Recommended query period by data aggregation interval for details.

    Example

    Request example

    The following code is an example of querying the all_byt_cnt (Metric) value of the server with instanceNo (Dimension) value "123456" in the "System/Server" product.

    POST /cw_fea/real/cw/api/data/query
    Host: cw.apigw.ntruss.com
    Content-Type: application/json
    x-ncp-apigw-signature-v2: {generated signature}
    x-ncp-apigw-timestamp: {current timestamp}
    x-ncp-iam-access-key: {your iam access key}
    
    Payload:
    
    {
      "timeEnd": 1565056980000, 
      "timeStart": 1565020800000,
      "cw_key": "xxxxxxxxxxxxxxxxxx",
      "productName":"System/Server",
      "metric": "all_byt_cnt",
      "interval": "Min1",
      "aggregation": "AVG",
      "dimensions": {
        "instanceNo": "123456"
      }
    }
    

    Response example

    The response is a JSON array with an internal array. The first element of the internal array is the timestamp of the data point, and the second element is the value.

    [
      [
        1553734800000,
        11.5
      ],
      [
        1553734860000,
        9.583333015441895
      ],
      [
        1553734920000,
        11.5
      ]
    ]
    

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.