文档中心 > API类目 > 天猫精灵开放API

alibaba.ailabs.iot.device.control.notify (天猫精灵IoT异步控制回调接口)

用于天猫精灵IoT云云接入控制结果的异步回调

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
notify_control_params NotifyVehicleControlParams 可选 入参
  • payload
  • Payload
  • 必须
  • 标准控制协议中的payload
  • └ error_code
  • String
  • 可选
  • INVALIDATE_PARAMS
  • 错误码,出错时返回
  • └ message
  • String
  • 可选
  • 请求参数有误
  • 错误信息,出错时返回
  • └ device_id
  • String
  • 必须
  • 12345
  • 设备id
  • header
  • IotCommonHeader
  • 必须
  • 标准控制协议中的header
  • └ namespace
  • String
  • 必须
  • AliGenie.Iot.Device.Control
  • 标准控制协议中的namespace
  • └ name
  • String
  • 必须
  • LockVehicleDoorResponse
  • 标准控制协议中的name
  • └ message_id
  • String
  • 必须
  • 1bd5d003-31b9-476f-ad03-71d471922820
  • 标准控制协议中的messageId
  • └ pay_load_version
  • Number
  • 必须
  • 1
  • 标准控制协议中的payLoadVersion
  • exceptions
  • IotCommonDeviceProperty []
  • 可选
  • 标准查询协议中的exceptions,异常检测项,如果有则返回,没有则不返回
  • └ name
  • String
  • 可选
  • LFDoor
  • 异常检测项名称
  • └ value
  • String
  • 可选
  • on
  • 异常检测项值
  • properties
  • IotCommonDeviceProperty []
  • 可选
  • 标准查询协议中的properties,异常检测项,如果有则返回,没有则不返回
  • └ name
  • String
  • 可选
  • vehicleLock
  • 查询的属性名称
  • └ value
  • String
  • 可选
  • locked
  • 查询的属性值

响应参数

名称 类型 示例值 描述
ret_value Boolean TRUE 是否通知成功

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaAilabsIotDeviceControlNotifyRequest req = new AlibabaAilabsIotDeviceControlNotifyRequest();
AlibabaAilabsIotDeviceControlNotifyRequest.NotifyVehicleControlParams obj1 = new AlibabaAilabsIotDeviceControlNotifyRequest.NotifyVehicleControlParams();
AlibabaAilabsIotDeviceControlNotifyRequest.Payload obj2 = new AlibabaAilabsIotDeviceControlNotifyRequest.Payload();
obj2.setErrorCode("INVALIDATE_PARAMS");
obj2.setMessage("请求参数有误");
obj2.setDeviceId("12345");
obj1.setPayload(obj2);
AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonHeader obj3 = new AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonHeader();
obj3.setNamespace("AliGenie.Iot.Device.Control");
obj3.setName("LockVehicleDoorResponse");
obj3.setMessageId("1bd5d003-31b9-476f-ad03-71d471922820");
obj3.setPayLoadVersion(1L);
obj1.setHeader(obj3);
List<AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty> list5 = new ArrayList<AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty>();
AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty obj6 = new AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty();
list5.add(obj6);
obj6.setName("LFDoor");
obj6.setValue("on");
obj1.setExceptions(list5);
List<AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty> list8 = new ArrayList<AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty>();
AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty obj9 = new AlibabaAilabsIotDeviceControlNotifyRequest.IotCommonDeviceProperty();
list8.add(obj9);
obj9.setName("vehicleLock");
obj9.setValue("locked");
obj1.setProperties(list8);
req.setNotifyControlParams(obj1);
AlibabaAilabsIotDeviceControlNotifyResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<alibaba_ailabs_iot_device_control_notify_response>
    <ret_value>TRUE</ret_value>
</alibaba_ailabs_iot_device_control_notify_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部