设备管理API 入口:
https://openapi.heclouds.com/common?action=具体接口名称&version=1
一. 创建设备
https://open.iot.10086.cn/doc/iot_platform/book/api/common/createDevice.html

根据要求我们使用POST方法, 同时填写必要的action和version

然后, 我们要在请求头中设置Content-type为 application/json

然后,我们要在请求的body中设置Content内容:

关于JSON的内容, 非常易懂, 和API文档中的请求参数格式一致即可
我们send一下:

请求成功了
我们看一下设备列表:

成功!
二. 设备批量创建
https://open.iot.10086.cn/doc/iot_platform/book/api/common/batchCreateDevice.html

和上一节基本一致, 不同只是在于body里的JSON格式
依旧POST

按上一节设置 content type
body这样写:

我们send 一下:

去设备管理界面验证一下:

三. 设备编辑(没卵用)

依旧是POST请求

依旧修改BODY里的JSON

回复如下:

查询一下控制台:

四. 删除设备
https://open.iot.10086.cn/doc/iot_platform/book/api/common/deleteDevice.html

前几步设置还是那样,
之后还是改POST的body

回复如下

的确删除了

五. 设备详情
查询设备详情API:https://open.iot.10086.cn/doc/iot_platform/book/api/common/queryDeviceDetail.html

首先, 这是一个GET请求, 所以,我们应该设置好基地址和get方法

然后,我们应该写入之前算好的token进行设备鉴权

然后, 根据API请求方法设置get的参数.
根据新版API调用格式, action 和 version是必须的
本例中 action是QueryDeviceDetail

然后, 我们就收到了服务器的回复了!!

网友评论