Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
smthing committed Jun 5, 2024
1 parent ee08db7 commit ea100d1
Showing 1 changed file with 98 additions and 2 deletions.
100 changes: 98 additions & 2 deletions pages/src/content/docs/guides/restapi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ driver-box 提供了一套常用的 REST API,方便开发者结合自身需求
**响应参数**
| 字段名 | 字段类型 | 字段描述 |
|-------|--------|-----------------|
| value | Device[] | 设备影子列表 |
| data | Device[] | 设备影子列表 |
<Tabs>
<TabItem label="Device模型结构">
| 字段名 | 字段类型 | 字段描述 |
Expand Down Expand Up @@ -277,5 +277,101 @@ driver-box 提供了一套常用的 REST API,方便开发者结合自身需求
</Tabs>

### 查询某个设备数据
**请求方式:** GET

**请求路径:** /api/v1/shadow/device

**接口描述:**
获取当前网关中指定设备 ID 的影子数据

**请求参数**

| 字段名 | 字段类型 | 是否必填 | 字段描述 |
| ------ | -------- | -------- | -------- |
|id|string||设备 ID|

**响应参数**
| 字段名 | 字段类型 | 字段描述 |
|-------|--------|-----------------|
| data | Device | 设备影子 |


**示例**

<Tabs>
<TabItem label="请求">
```shell
curl http://127.0.0.1:8081/api/v1/shadow/device?id=swtich-1
```
</TabItem>
<TabItem label="响应">
```json
{
"success": true,
"errorCode": 200,
"errorMsg": "",
"data": {
"id": "swtich-1",
"points": [
{
"name": "onOff",
"value": 1,
"updated_at": "2024-06-05 16:27:41",
"write_time": "0001-01-01 00:00:00"
}
],
"online": false,
"ttl": "5m0s",
"disconnect_times": 0,
"updated_at": "2024-06-05 16:32:41"
}
}
```
</TabItem>
</Tabs>

### 查询某个设备点位数据
### 查询某个设备点位数据
**请求方式:** GET

**请求路径:** /api/v1/shadow/devicePoint

**接口描述:**
获取当前网关中指定设备的某个点位影子数据

**请求参数**

| 字段名 | 字段类型 | 是否必填 | 字段描述 |
| ------ | -------- | -------- | -------- |
|id|string||设备 ID|
|point|string||点位名|

**响应参数**
| 字段名 | 字段类型 | 字段描述 |
|-------|--------|-----------------|
| data | DevicePoint | 设备影子 |


**示例**

<Tabs>
<TabItem label="请求">
```shell
curl http://127.0.0.1:8081/api/v1/shadow/devicePoint?id=swtich-1&point=onOff
```
</TabItem>
<TabItem label="响应">
```json
{
"success": true,
"errorCode": 200,
"errorMsg": "",
"data": {
"name": "onOff",
"value": 1,
"updated_at": "2024-06-05 16:27:41",
"write_time": "0001-01-01 00:00:00"
}
}
```
</TabItem>
</Tabs>

0 comments on commit ea100d1

Please sign in to comment.