All Products
Search
Document Center

IoT Platform:ListAnalyticsData

Last Updated:Sep 19, 2023

Executes a data service API operation-related query task to obtain data from a data source.

Usage notes

You can call this operation up to five times per second per account.

Note

The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

ListAnalyticsData

The operation that you want to perform. Set the value to ListAnalyticsData.

ApiPath

String

Yes

/iot-cn-npk1v******/system/query/hist_dev_cnt_stat

The path of the API operation.

To obtain the value of the API Path parameter in the IoT Platform console, go to the Data Service API page and view the details page of the API operation.

Condition.N.FieldName

String

Yes

testCode

The name of the conditional column of the API operation.

To obtain the value of the conditional column in the IoT Platform console, go to the Data Service API page and view the details page of the API operation.

Condition.N.Operate

String

Yes

=

The comparison operator.

Valid values: BETWEEN, =, !=, LIKE, IN, and NIN.

To obtain the operators that are available for the conditional column in the IoT Platform console, go to the Data Service API page and view the details page of the API operation.

  • BETWEEN: the value of the conditional column is within a specific value range.

  • =: the value of the conditional column is a specific value.

  • !=: the value of the conditional column is not a specific value.

  • LIKE: the value of the conditional column starts with a specific value.

  • IN: the value of the conditional column is within a specific collection.

  • NIN: the value of the conditional column is not within a specific collection.

For example, a data collection has six records and the value of the time column of each record is abcd, abce, abcf, abcg, aabc, and abbc. When you call the ListAnalyticsData operation, specify time for the Condition.N.FieldName parameter.

  • If you specify LIKE for the Condition.N.Operate parameter and specify abc for the Condition.N.Value parameter, records whose time column is of the following values are returned: abcd, abce, abcf, and abcg.

  • If you specify IN for the Condition.N.Operate parameter and specify [abcd,abce,abcf] for the Condition.N.Value parameter, records whose time column is of the following values are returned: abcd, abce, and abcf.

Note

If you specify BETWEEN for the Condition.N.Operate parameter, you must configure the Condition.N.BetweenStart and Condition.N.BetweenEnd parameters. If you do not specify BETWEEN for the Condition.N.Operate parameter, you must configure the Condition.N.Value parameter.

IotInstanceId

String

Yes

iot-cn-npk1u******

The ID of the instance to which the API operation belongs.

For more information, see Obtain the ID of an instance.

IsoId

String

No

oxs_iso_id

The ID of the logical isolation. Ignore this parameter.

PageSize

Integer

No

100

The number of entries per page.

Valid values: 1 to 100. Default value: 100.

Note

If you enable pagination, you must configure this parameter.

Condition.N.Value

String

No

4

The value of the conditional column.

To obtain the value of the conditional column in the IoT Platform console, go to the Data Service API page and view the details page of the API operation.

Note

If you do not specify BETWEEN for the Condition.N.Operate parameter, you must configure the Condition.N.Value parameter and you do not need to configure the Condition.N.BetweenStart and Condition.N.BetweenEnd parameters.

Condition.N.BetweenStart

String

No

1

The beginning of the value range.

To obtain the value range of the conditional column in the IoT Platform console, go to the Data Service API page and view the details page of the API operation.

Note

If you specify BETWEEN for the Condition.N.Operate parameter, you must configure the Condition.N.BetweenStart parameter and you do not need to configure the Condition.N.Value parameter.

Condition.N.BetweenEnd

String

No

5

The end of the value range.

To obtain the value range of the conditional column in the IoT Platform console, go to the Data Service API page and view the details page of the API operation.

Note

If you specify BETWEEN for the Condition.N.Operate parameter, you must configure the Condition.N.BetweenEnd parameter and you do not need to configure the Condition.N.Value parameter.

PageNum

Integer

No

1

The number of the page to return. Default value: 1.

In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common parameters.

Response parameters

Parameter

Type

Example

Description

Code

String

Success

The response code. Valid values:

  • Success: The call was successful.

  • Other values: The call failed. For more information, see Error codes.

Data

Struct

The data returned if the call is successful.

Count

Long

3

The total number of entries returned.

HasNext

Boolean

false

Indicates whether the next page exists. Valid values:

  • true: The next page exists.

  • false: The next page does not exist.

PageNum

Integer

1

The page number.

PageSize

Integer

100

The number of entries per page.

ResultJson

String

[{\"testCode\":\"TBB186\",\"testLevel\":5,\"testWorkYears\":3,\"testName\":\"Jack\"},{\"testCode\":\"TBB1314\",\"testLevel\":2,\"testWorkYears\":4,\"testName\":\"Tom\"},{\"testCode\":\"TBB8888\",\"testLevel\":2,\"testWorkYears\":5,\"testName\":\"Eric\"}]"

The details of the returned data.

ErrorMessage

String

insufficient auth: no access permissions

The error message returned if the call fails.

RequestId

String

7EC5B624-AF1B-4C4D-BA82-A02BA1******

The ID of the request.

Success

Boolean

false

Indicates whether the call was successful. Valid values:

  • true: The call was successful.

  • false: The call failed.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=ListAnalyticsData
&ApiPath=/iot-cn-npk1v******/system/query/hist_dev_cnt_stat
&Condition.1.FieldName=testCode
&Condition.1.Operate==
&IotInstanceId=iot-cn-npk1u******
&<Common request parameters>

Sample success responses

XML format

<ListAnalyticsDataResponse>
  <RequestId> 7EC5B624-AF1B-4C4D-BA82-A02BA1******</RequestId>
  <Data>
        <ResultJson>[{\"testCode\":\"TBB186\",\"testLevel\":5,\"testWorkYears\":3,\"testName\":\"Jack\"},{\"testCode\":\"TBB1314\",\"testLevel\":2,\"testWorkYears\":4,\"testName\":\"Tom\"},{\"testCode\":\"TBB8888\",\"testLevel\":2,\"testWorkYears\":5,\"testName\":\"Eric\"}]"</ResultJson>
        <PageSize>100</PageSize>
        <PageNum>1</PageNum>
        <Count>3</Count>
        <HasNext>false</HasNext>
  </Data>
  <Code>Success</Code>
  <Success>true</Success>
</ListAnalyticsDataResponse>

JSON format

{
    "RequestId": "7EC5B624-AF1B-4C4D-BA82-A02BA1******",
    "Data": {
        "ResultJson": "[{\"testCode\":\"TBB186\",\"testLevel\":5,\"testWorkYears\":3,\"testName\":\"Jack\"},{\"testCode\":\"TBB1314\",\"testLevel\":2,\"testWorkYears\":4,\"testName\":\"Tom\"},{\"testCode\":\"TBB8888\",\"testLevel\":2,\"testWorkYears\":5,\"testName\":\"Eric\"}]",
        "PageSize": 100,
        "PageNum": 1,
        "Count": 3,
        "HasNext": false
    },
    "Code": "Success",
    "Success": true
}

Error codes

For a list of error codes, see Service error codes.