查询历史数据的接口
名称 | 类型 | 是否必须 | 示例值 | 更多限制 | 描述 | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|
work_bench_context | WorkBenchContext | 必须 | 请求端信息 | ||||||||
|
|||||||||||
query | DeviceDataApiQuery | 必须 | 历史数据查询对象 | ||||||||
|
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
result | PageResult | 出参 | |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret); AlibabaCampusDeviceOpenapiGethistorydataRequest req = new AlibabaCampusDeviceOpenapiGethistorydataRequest(); AlibabaCampusDeviceOpenapiGethistorydataRequest.WorkBenchContext obj1 = new AlibabaCampusDeviceOpenapiGethistorydataRequest.WorkBenchContext(); obj1.setCompanyId(100000L); obj1.setCampusId(100001L); req.setWorkBenchContext(obj1); AlibabaCampusDeviceOpenapiGethistorydataRequest.DeviceDataApiQuery obj2 = new AlibabaCampusDeviceOpenapiGethistorydataRequest.DeviceDataApiQuery(); obj2.setLimit(20L); obj2.setStartDate(StringUtils.parseDateTime( "2018-01-29 00:00:00" )); obj2.setPropertyCode( "electric_p" ); obj2.setEndDate(StringUtils.parseDateTime( "2018-01-30 00:00:00" )); obj2.setCurrentPage(1L); obj2.setUuid( "b14a0b26-5745-4a85-97b1-5e2d0fbdc5bd" ); req.setQuery(obj2); AlibabaCampusDeviceOpenapiGethistorydataResponse rsp = client.execute(req); System.out.println(rsp.getBody()); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | < alibaba_campus_device_openapi_gethistorydata_response > < result > < content > < total >1506</ total > < limit >20</ limit > < results > < device_data_api_dto > < device_id >b14a0b26-5745-4a85-97b1-5e2d0fbdc5bd</ device_id > < device_code >8-5-1电视机插座计量</ device_code > < property_code >electric_p</ property_code > < value >0.351</ value > < timestamp >1517155225</ timestamp > < value_type >20200</ value_type > < value_type_name >数字型</ value_type_name > < unit_id >31002</ unit_id > < unit_code >KW</ unit_code > </ device_data_api_dto > </ results > < current_page >1</ current_page > < total_page >76</ total_page > </ content > < error_code >200</ error_code > < error_msg >null</ error_msg > < success >success</ success > </ result > </ alibaba_campus_device_openapi_gethistorydata_response > |
1 2 3 4 5 6 | < error_response > < code >50</ code > < msg >Remote service error</ msg > < sub_code >isv.invalid-parameter</ sub_code > < sub_msg >非法参数</ sub_msg > </ error_response > |
错误码 | 错误描述 | 解决方案 |
---|