Skip to content

Commit cb53d0c

Browse files
committed
Change mdash api
1 parent ccb1c61 commit cb53d0c

File tree

1 file changed

+58
-14
lines changed

1 file changed

+58
-14
lines changed

mdash/api.md

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,62 @@ HTTP header. Those API calls that use `POST` or `PUT`, should specify
1010
https://dash.mongoose-os.com/api/v2/devices/DEVICE_ID/rpc/GPIO.Toggle
1111
true</code></pre>
1212

13+
## GET /devices
1314

14-
| Method | Endpoint | Params | Description |
15-
| ------ | ---------------- | ------ | ----------- |
16-
| GET | /devices | &nbsp; | List all registered devices |
17-
| POST | /devices | &nbsp; | Register new device |
18-
| POST | /devices/:id | {"name": "x", "shared_with": "github_user1", "shadow": ...} | Change device properties |
19-
| DELETE | /devices/:id | &nbsp; | Delete device |
20-
| POST | /devices/:id/rpc/:func | {...} | Call device's RPC function |
21-
| POST | /devices/:id/ota | fw.zip | OTA: `curl -v -F [email protected] URL` |
22-
| GET | /devices/:id/data | &nbsp; | Get device saved data |
23-
| GET | /keys | &nbsp; | List all API keys |
24-
| POST | /keys | &nbsp; | Create an API key |
25-
| DELETE | /keys/:id | &nbsp; | Delete an API key |
26-
| POST | /logs | {"start": 0} | Get stored notification logs |
27-
| GET | /devices/data | &nbsp; | Get data from all devices |
15+
List all registered devices. Params: none.
16+
17+
## POST /devices
18+
19+
Register new device. Params: none.
20+
21+
## POST /devices/:id
22+
23+
Change device properties. Params:
24+
25+
```javascript
26+
{
27+
"name": "MyCoolDeviceName",
28+
"shared_with": "github_user1,github_user2",
29+
"shadow": ...
30+
}
31+
```
32+
33+
Any key in the params is optional.
34+
35+
36+
## DELETE /devices/:id
37+
38+
Delete device. Params: none.
39+
40+
## POST /devices/:id/rpc/:func
41+
42+
Call device's RPC function. Params: any valid JSON string, which is expected by the function.
43+
44+
45+
## POST /devices/:id/ota
46+
47+
Perform device OTA. Params: a binary content of the firmware .zip file. Example: `curl -v -F [email protected] URL`.
48+
49+
## GET /devices/:id/data
50+
51+
Get device saved data. Params: none.
52+
53+
## GET /keys
54+
55+
List all API keys. Params: none.
56+
57+
## POST /keys
58+
59+
Create an API key. Params: none.
60+
61+
## DELETE /keys/:id
62+
63+
Delete an API key. Params: none.
64+
65+
## POST /logs
66+
67+
Get stored notification logs. Params: `{"start": 0}` - an offset to start from.
68+
69+
## GET /devices/data
70+
71+
Get data from all devices. Params: none.

0 commit comments

Comments
 (0)