API 文档
      
    
    API 授权凭证
API 授权凭证为用户登陆的 token,可以通过小程序的 props 来获得。
token 可以放在请求的 headers 或者 body 或者 query 里面
eg.
curl -H 'X-REQUEST-TOKEN: token' you-api-urleg.
curl -d 'token=token' you-api-urleg.
curl you-api-url?token=token获取实时数据
GET /api/devices/:uuid/telemetry/
- query 时间区间 after now - 7d,between "2015-01" and "2015-02",before '2018'
- fields 查询函数或点 last(),*
- columns 查询规则或字段 .*,some_key,some_key1|some_key2
- multi 多字段查询 true,false
获取设备信息
GET /api/devices/:uuid/
更改设备信息
POST /api/devices/:uuid/meta/
- meta 设备信息 JSON 字符串 {"name": "the_name"}
RPC 通讯
POST /api/devices/:uuid/rpc/
- data 请求指令 {"method": "switch_on", "index": 1}
- format 返回的数据格式 json,raw
- timeout 超时时间 300
Websockets 实时数据推送
/feed/:uuid/ws/?token=you_token
JSON 格式的实时数据
添加下行指令
只对使用HTTP/HTTPS接入的设备有效
POST /api/devices/:uuid/downlink/
- body 为指令内容
curl https://iot.giveyun.com/api/devices/my_uuid/downlink/ \
    -H 'Content-Type: application/json' \
    -H 'X-REQUEST-TOKEN: my_user_token' \
    -d '{"method": "open"}'查看待下发的下行指令
只对使用HTTP/HTTPS接入的设备有效
GET /api/devices/:uuid/downlinks/
curl https://iot.giveyun.com/api/devices/my_uuid/downlinks/ \
    -H 'X-REQUEST-TOKEN: my_user_token'删除待下发的下行指令
只对使用HTTP/HTTPS接入的设备有效
DELETE /api/devices/:uuid/downlink/:id/
curl https://iot.giveyun.com/api/devices/my_uuid/downlink/1/ \
    -H 'X-REQUEST-TOKEN: my_user_token' \
    -XDELETE