edit-icon download-icon

Universal dataset query APIs

Last Updated: Apr 12, 2018

Description

ARMSQueryDataSet queries the data in ARMS datasets.

API name Request Response
ARMSQueryDataSet ARMSQueryDataSetRequest ARMSQueryDataSetResponse

Request parameters

Request parameters include POP public parameters and business parameters.For public request parameters, see POP parameter description.

Business parameter description

Alibaba Cloud encapsulates all request parameters in a request, and returns a response.

ARMSQueryDataSetRequest contains 11 fields.

Field name Field type Setting method Field description Required/Optional Note
datasetId Long setDatasetId Dataset ID Required
minTime Long setMinTime Start time of data query Required
maxTime Long setMaxTime End time of data query Required
intervalInSec Integer setIntervalInSec Interval of data piece Required
measures List[String] setMesures Query measure list Optional The list can contain up to three elements.If the parameter is left unspecified, all measures are returned.
dimensions List[Dimension] setDimensions Query dimension list Optional Drill-down dataset field. “dimensions” is a compound parameter. The list can have contain up to three elements.For the definition of the dimension, see the next table.
requiredDims List[Dimension] setRequiredDims Required dimensions of a common dataset Optional Common dataset field
optionalDims List[Dimension] setOptionalDims Optional dimensions of a common dataset Optional Common dataset field
orderByKey String setOrderByKey orderBy measure Optional
limit Integer setLimit The limit to the number of returned results Optional
reduceTail Boolean setReduceTail If to aggregate all data beyond the limit Optional
  • If the dataset to be queried is a drill-down dataset, use “dimensions”.
  • If the dataset to be queried is a common dataset, use “requiredDims” and “optionalDims”.
  • For differences between a drill-down dataset and a common dataset, see Create a dataset.

Description of the “dimensions” compound parameter

Field name Field type Setting method Field description Note
key String setKey Dimension name For example, region
value String setValue Dimension value For example, Beijing
type String setType Value type Options include STATIC, ALL, and DISABLED.
  • To select all values under a dimension, set “type” to “All” and “value” to “null”.
  • To select a specific value under a dimension, set “type” to “STATIC” and “value” to the entered dimension value.
  • If you don’t want to select a dimension, ignore this dimension, or set “type” to “DISABLED”.

Response parameters

Response parameters are returned as JSON strings. You can retrieve response values with ARMSQueryDataSetResponse.getdata().

ARMSQueryDataSetRequest contains the following fields:

Field name Field description Note
dimensions Dimension value of the time series data If this field is set to “ALL”, multiple dimensions are available.
measures Measures in the data point
resultSize Number of all data points returned
dimData Multiple time series data records

Examples

  1. If no dimension is selected, summary information of all data is queried.

    1. include_once 'aliyun-php-sdk-core/Config.php';
    2. include_once 'aliyun-php-sdk-arms/ARMS/Request/V20161125/ARMSQueryDataSetRequest.php';
    3. include_once 'aliyun-php-sdk-arms/ARMS/Request/V20161125/WhereInDimQueryRequest.php';
    4. use ARMS\Request\V20161125\ARMSQueryDataSetRequest as ARMSQueryDataSetRequest;
    5. //Set the connection parameters, where the endpoint is “cn-hangzhou”, "cn-beijing”, and so on, and fill in your actual AccessKey and SecretKey.
    6. $iClientProfile = DefaultProfile::getProfile("cn-hangzhou", "your_ak", "your_sk");
    7. $client = new DefaultAcsClient($iClientProfile);
    8. $request = new ARMSQueryDataSetRequest();
    9. //Enter the correct dataset ID.
    10. $request->setDatasetId(12221);
    11. //Time granularity, for example 60s.
    12. $request->setIntervalInSec(60);
    13. //Minimum time. In this example, it is one hour before the current time.
    14. $request->setMinTime((int)time()*1000 - 3600000);
    15. //Maximum time, which can be set to the current time.
    16. $request->setMaxTime((int)time()*1000);
    17. // ****Insert the code of Example 2, 3, and 4 here.****
    18. //Send the request.
    19. $response = $client->doAction($request);
    20. //Print the request.
    21. print_r( $response->getBody());
  2. Select the first dimension, and set the dimension value to an empty string (“”) and the dimension type to “ALL”.The data grouped by the first dimension is returned.

    1. $dims = array (array("Key"=>"Category", "Value" => "", "Type" => "ALL"));
    2. $request->setDimensionss($dims);
  3. Select the first dimension, and set the dimension value to a fixed value, for example “hangzhou”, and set the dimension type to “STATIC” (fixed value).The data of hangzhou is returned based on the first dimension:

    1. $dims = array (array("Key"=>"Category", "Value" => "nanzhuang", "Type" => "STATIC"));
    2. $request->setDimensionss($dims);
  4. Select the measure list to be queried. Only the specified measures are returned.

    1. $measures = array ("COUNT__line");
    2. $request->setMeasuress($measures);
Thank you! We've received your feedback.