Queries the original service records that are submitted by a specified device. These records include services that are verified and not verified by a specified Thing Specification Language (TSL) model.

Limits

  • You can query only the service call records that are generated in the last 30 days.
Note The storage period of a service call record is calculated from the day when the service is called.
  • Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
    Note Resource Access Management (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 QueryDeviceOriginalServiceData

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

Asc Integer Yes 0

The sorting order of the returned service call records. Valid values:

  • 0: descending.
  • 1: ascending.
Note The start time must be earlier than the end time. The system sorts the returned records based on the specified order.
EndTime Long Yes 1579249499000

The end of the time range to query. The value must be a 13-digit timestamp.

Identifier String Yes Set

The identifier of the service.

  • If low-level verification is applied, you can perform the following steps to view the Identifier of a device event: Log on to the IoT Platform console and go to the Define Feature tab of the Product Details page. You can also call the QueryThingModel operation and view the service identifier in the returned TSL data.
  • If no verification is applied, the value must be the same as the value of the custom identifier that is submitted by the device.
PageSize Integer Yes 10

The number of entries to return on each page. Maximum value: 50.

StartTime Long Yes 1579249498000

The start of the time range to query. The value must be a 13-digit timestamp.

IotInstanceId String No iot_instc_pu****_c*-v64********

The ID of the instance. You can view the instance ID on the Overview page in the IoT Platform console.

Notice
  • If your instance has an ID, you must configure this parameter. If you do not set this parameter, the call fails.
  • If your instance has no Overview page or ID, you do not need to set this parameter.

For more information, see Overview.

ProductKey String No a1BwAGV****

The ProductKey of the product to which the device belongs.

Note If you specify this parameter, you must also specify the DeviceName parameter.
DeviceName String No light

The name of the device.

Note If you specify this parameter, you must also specify the ProductKey parameter.
NextPageToken String No Bo***x44Qx

The identifier of the next page. The response to the first request contains this parameter, which will be added to the next request.

IotId String No Q7uOhVRdZRRlDnTLv****00100

The ID of the device. It is the unique identifier that IoT Platform generated for the device.

Note If you specify this parameter, you do not need to specify the ProductKey or DeviceName parameter. The IotId parameter specifies a unique identifier for the device, and corresponds to a combination of the ProductKey and DeviceName parameters. If you specify the IotId parameter and a combination of the ProductKey and DeviceName parameters at the same time, the IotId parameter takes precedence.

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

Response parameters

Parameter Type Example Description
Code String iot.device.InvalidIoTId

The error code returned if the call fails. For more information, see Error codes.

Data Struct

The service call records returned if the call succeeds.

List Array of ServiceInfo

The array of service call records. Each element represents a service call record. For more information about the details of a service, see the parameters that belong to the ServiceInfo parameter.

ServiceInfo
Identifier String Set

The identifier of the service.

InputData String {\"code\":200,\"data\":{},\"id\":\"100686\",\"message\":\"success\",\"version\":\"1.0\"}

The input parameter of the service. The value is a string in the MAP format. Syntax: key:value.

Name String Set_Temperature

The service name.

OutputData String {\"LightAdjustLevel\":123}

The output parameter of the service. The value is a string in the MAP format. Syntax: key:value.

Time String 1579249499000

The time when the service was called.

NextPageToken String Bo***x44Qx

The identifier of the next page.

NextValid Boolean true

Indicates whether the next page exists.

  • true: The next page exists.
  • false: The next page does not exist.

If the value true is returned, you can add the value of the NextPageToken parameter to the next request. This allows you to query the data that is not included in the current query.

ErrorMessage String A system exception has occurred.

The error message returned if the call fails.

RequestId String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The ID of the request.

Success Boolean true

Indicates whether the call succeeds.

  • true: The call succeeded.
  • false: The call failed.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/? Action=QueryDeviceOriginalServiceData
&Asc=0
&EndTime=1579249499000
&Identifier=Set
&PageSize=10
&StartTime=1579249498000
&<Common request parameters>

Sample success responses

XML format

<QueryDeviceOriginalServiceDataResponse>
  <Data>
        <NextValid>true</NextValid>
        <NextPageToken>Bo***x44Qx</NextPageToken>
        <List>
              <ServiceInfo>
                    <Name>set</Name>
                    <Time>1517315865198</Time>
                    <OutputData>{"code":200,"data":{},"id":"100686","message":"success","version":"1.0"}</OutputData>
                    <InputData>{"LightAdjustLevel":123}</InputData>
                    <Identifier>set</Identifier>
              </ServiceInfo>
        </List>
  </Data>
  <RequestId>A44C818E-FA7F-4765-B1E7-01D14AE01C6A</RequestId>
  <Success>true</Success>
</QueryDeviceOriginalServiceDataResponse>

JSON format

{
  "Data": {
    "NextValid": true, 
    "NextPageToken": "Bo***x44Qx", 
    "List": {
      "ServiceInfo": [
        {
          "Name": "set", 
          "Time": 1517315865198, 
          "OutputData": "{\"code\":200,\"data\":{},\"id\":\"100686\",\"message\":\"success\",\"version\":\"1.0\"}", 
          "InputData": "{\"LightAdjustLevel\":123}", 
          "Identifier": "set"
        }
      ]
    }
  }, 
  "RequestId": "A44C818E-FA7F-4765-B1E7-01D14AE01C6A", 
  "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.