通用设备API
获取通用设备客户端信息
接口地址
POST /api/v1.0/invoke/open-ability/method/general-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| device_id | String | Body | 是 | 设备ID |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| client_id | String | Body | 客户端ID |
| username | String | Body | 连接账号 |
| password | String | Body | 连接密码 |
| domain | String | Body | 域名 |
| port | String | Body | 端口 |
| online | Boolean | Body | 判断设备在离线状态 true:在线 false:离线 |
| topic | Object<topic> | Body | 主题 |
| command | Object<command> | Body | 命令 |
topic说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| up_topic | String | Body | 上行主题 |
| down_topic | String | Body | 下行主题 |
command说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| up_command | String | Body | 上行命令 |
| down_command | String | Body | 下行命令 |
请求示例
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "get_general_device_client_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"device_id": "d31adc223cc4b3bedb6bd4742dedcfa52"
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"client_id": "c8b5a73f8dd84abaa94dcs288be49b0cx",
"username": "ud8b5a73f8dd84abaa94dcs288be49b0c",
"password": "pud8b5a73f8dd84abaa94dcs288be49b0",
"domain": "my.akubela.com",
"port": "8883",
"online": true,
"topic": {
"up_topic": "$sys/up/v1/edge/c8b5a73f8dd84abaa94dcs288be49b0cx",
"down_topic": "$sys/down/v1/edge/c8b5a73f8dd84abaa94dcs288be49b0cx"
},
"command": {
"up_command": "v1.0_u_general_up_message",
"down_command": "v1.0_d_general_down_message"
}
}
}
失败返回示例
见 接口失败返回
创建通用设备客户端信息
接口地址
POST /api/v1.0/invoke/open-ability/method/general-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object | Body | 是 | 命令参数 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| device_id | String | Body | 设备ID |
| client_id | String | Body | 客户端ID |
| username | String | Body | 连接账号 |
| password | String | Body | 连接密码 |
| domain | String | Body | 域名 |
| port | String | Body | 端口 |
| topic | Object<topic> | Body | 主题 |
| command | Object<command> | Body | 命令 |
topic说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| up_topic | String | Body | 上行主题 |
| down_topic | String | Body | 下行主题 |
command说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| up_command | String | Body | 上行命令 |
| down_command | String | Body | 下行命令 |
请求示例
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "create_general_device_client_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"device_id": "d31adc223cc4b3bedb6bd4742dedcfa52"
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"device_id": "d31adc223cc4b3bedb6bd4742dedcfa5d",
"client_id": "c8b5a73f8dd84abaa94dcs288be49b0w1",
"username": "ud8b5a73f8dd84abaa94dcs288be49b0a",
"password": "pud8b5a73f8dd84abaa94dcs288be49bc",
"domain": "my.akubela.com",
"port": "8883",
"topic": {
"up_topic": "$sys/up/v1/edge/c8b5a73f8dd84abaa94dcs288be49b0w1",
"down_topic": "$sys/down/v1/edge/c8b5a73f8dd84abaa94dcs288be49b0w1"
},
"command": {
"up_command": "v1.0_u_general_up_message",
"down_command": "v1.0_d_general_down_message"
}
}
}
失败返回示例
见 接口失败返回
创建通用设备信息
接口地址
POST /api/v1.0/invoke/open-ability/method/general-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object | Body | 是 | 命令参数 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object<result> | Body | 返回结果 |
result说明
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| device_id | String | Body | 设备ID |
请求示例
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "create_general_device_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"device_id": "d31adc223cc4b3bedb6bd4742dedcfa5d"
}
}
失败返回示例
见 接口失败返回
删除通用设备信息
接口地址
POST /api/v1.0/invoke/open-ability/method/general-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| device_id | String | Body | 是 | 设备ID |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "delete_general_device_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"device_id": "d1b5a73f8dd84abaa94dcs248be49b0d1"
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回
批量删除通用设备信息
接口地址
POST /api/v1.0/invoke/open-ability/method/general-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| devices | []Object<device> | Body | 是 | 设备信息 |
device说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| device_id | String | Body | 是 | 设备ID |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "batch_delete_general_device_info",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"devices": [
{
"device_id": "d1b5a73f8dd84abaa94dcs248be49b0d1"
}
]
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回
触发通用设备下行消息
接口地址
POST /api/v1.0/invoke/open-ability/method/general-commands
请求参数
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Content-Type | String | Header | 是 | 内容类型,值为application/json |
| Accept | String | Header | 是 | 接受类型,值为application/json |
| Authorization | String | Header | 是 | Bearer认证,访问令牌 |
| command | String | Body | 是 | 命令名称 |
| id | String | Body | 是 | 命令ID |
| param | Object<param> | Body | 是 | 命令参数 |
param说明
| 参数名 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| device_id | String | Body | 是 | 设备ID |
| data | Object | Body | 是 | 数据 |
返回参数
| 参数名 | 类型 | 位置 | 说明 |
|---|---|---|---|
| Content-Type | String | Header | 内容类型,值为application/json |
| success | Boolean | Body | 判断请求是否成功 true:成功 false:失败 |
| timestamp | Integer | Body | 时间戳 |
| result | Object | Body | 返回结果 |
请求示例
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "trigger_general_device_down_message",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"device_id": "d1b5a73f8dd84abaa94dcs248be49b2d6",
"data": {}
}
}
成功返回示例
状态码:200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {}
}
失败返回示例
见 接口失败返回