# QueryDeviceServiceData

调用接口QueryDeviceServiceData查询指定设备的服务调用记录。

# 请求参数

# 请求方式1

名称 类型 是否必选 示例值 描述
Action String QueryDeviceServiceData 系统规定参数。取值:QueryDeviceServiceData。
EndTime Long 1579249499000 要查询的服务调用记录的结束时间。例如:1579249499000。
StartTime Long 1579249499000 要查询的服务调用记录的开始时间。例如:1579249499000。
IotInstanceId String 6912917943269**** 实例 ID。您可在物联网平台控制台的实例概览页面,查看当前实例的 ID。
ProductKey String a1BwAGV**** 要查询的设备所属的产品ProductKey。
DeviceName String light 要查询的设备名称。
Asc Integer 0 返回结果中,服务调用记录按时间排序的方式。取值: 0:倒序。1:正序。
CurrentPage Integer 1 指定显示返回结果中的第几页的内容。默认值是 1。
PageSize Integer 10 返回结果中每页显示的记录数。数量限制:每页最多可显示50条。
Identifier String set 要查询的服务标识符。设备的服务Identifier。可在控制台中,设备所属的产品的功能定义中查看;或调用QueryThingModel。

# 请求方式2

名称 类型 是否必选 示例值 描述
Action String QueryDeviceServiceData 系统规定参数。取值:QueryDeviceServiceData。
EndTime Long 1579249499000 要查询的服务调用记录的结束时间。例如:1579249499000。
StartTime Long 1579249499000 要查询的服务调用记录的开始时间。例如:1579249499000。
IotInstanceId String 6912917943269**** 实例 ID。您可在物联网平台控制台的实例概览页面,查看当前实例的 ID。
IotId String Q7uOhVRdZRRlDnTLv****00100 要查询的设备ID。物联网平台为该设备颁发的ID,设备的唯一标识符。
Asc Integer 0 返回结果中,服务调用记录按时间排序的方式。取值: 0:倒序。1:正序。
CurrentPage Integer 1 指定显示返回结果中的第几页的内容。默认值是 1。
PageSize Integer 10 返回结果中每页显示的记录数。数量限制:每页最多可显示50条。
Identifier String set 要查询的服务标识符。设备的服务Identifier。可在控制台中,设备所属的产品的功能定义中查看;或调用QueryThingModel。

# 返回数据

名称 类型 示例值 描述
Code String iot.system.SystemException 调用失败时,返回的错误码。
Data Struct 调用成功时,返回的产品信息。具体信息请参见以下参数。
CurrentPage Integer 1 当前页号。
List Array of ServiceInfo 服务调用记录信息集合(ServiceInfo)。
ServiceInfo
Identifier String set 服务标识符。
Name String set 服务名称。
InputData String {"LightAdjustLevel":123} 服务的输入参数,MAP格式的字符串,结构为key:value。
OutputData String {"code":200,"data":{},"id":"100686","message":"success","version":"1.0"} 服务的输出参数,MAP格式的字符串,结构为key:value。
Time Long 1579249499000 调用服务的时间。
PageCount Integer 92 总页数。
PageSize Integer 2 每页显示的产品数。
Total Integer 184 产品总数。
ErrorMessage String 系统异常 调用失败时,返回的出错信息。
RequestId String 5uBO0qPQCgvK6HFOSszqN5baKBaAIxfS 平台为该请求生成的唯一标识符。
Success Boolean true 是否调用成功。
true:表示调用成功。
false:表示调用失败。

# 示例

请求示例

http://open.${区域}.fenydata.com/fenydata-java-open/?Action=QueryDeviceServiceData
&IotInstanceId=6912917943269****
&ProductKey=a1BwAGV****
&DeviceName=device1
&PageSize=10
&CurrentPage=1
&Identifier=set
&StartTime=2025-06-14 07:31:40
&EndTime=2025-06-14 11:31:40
&Asc=1
&<公共请求参数>

正常返回示例

XML格式

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xml>
    <Data>
        <PageCount>1</PageCount>
        <PageSize>2</PageSize>
        <CurrentPage>1</CurrentPage>
        <List>
            <ServiceInfo>
                <OutputData>{"code":200,"data":{},"id":"100686","message":"success","version":"1.0"}</OutputData>
                <InputData>{"LightAdjustLevel":123}</InputData>
                <Identifier>set</Identifier>
                <Name>set</Name>
                <Time>1517315865198</Time>
            </ServiceInfo>
        </List>
        <Total>1</Total>
    </Data>
    <RequestId>93F05C63-9FD1-4CC8-B0FF-6D6C1A6632D1</RequestId>
    <Success>true</Success>
</xml>

JSON格式

{
  "Data": {
    "PageCount": 1,
    "PageSize": 2,
    "CurrentPage": 1,
    "List": {
      "ServiceInfo": [
        {
          "OutputData": "{\"code\":200,\"data\":{},\"id\":\"100686\",\"message\":\"success\",\"version\":\"1.0\"}",
          "InputData": "{\"LightAdjustLevel\":123}",
          "Time": 1517315865198,
          "Identifier": "set",
          "Name": "set"
        }
      ]
    },
    "Total": 1
  },
  "RequestId": "93F05C63-9FD1-4CC8-B0FF-6D6C1A6632D1",
  "Success": true
}