通用設備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": {}
}
失敗返回示例
見 接口失敗返回