查看Cloud Of Things API的源代码
←
Cloud Of Things API
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== Datapoints == 对应一个特定的传感器,属传感器的数据 === Create === <br> {| border="0" width=650 cellspacing="1" cellpadding="8" align="left" bgcolor=#1b74c2 | style="background:#dee7ec" width=80| URL | style="background:#ffffff" | http://api.easyhomelink.org/v1/device/DEV_ID/sensors/SEN_ID/datapoints |- | style="background:#dee7ec" | Formats | style="background:#ffffff" | JSON |- | style="background:#dee7ec" | Methods | style="background:#ffffff" | POST |- | style="background:#dee7ec" | Returns | style="background:#ffffff" | 无 |} 例子: data.txt <pre> POST /v1/device/1/sensor/1/datapoints HTTP/1.1 Accept: */* x-key: asdf1234 Content-Length: 15 Content-Type: text/html {"value":17.2} </pre> 或者 data.txt <pre> POST /v1/device/1/sensor/1/datapoints HTTP/1.1 Accept: */* x-key: asdf1234 Content-Length: 49 Content-Type: text/html {"timestamp":"2013-01-09T13:23:20", "value":17.2} </pre> <pre> cat req.txt | nc easyhomelink.org 3000 </pre> 系统支持数值型传感器和地理位置型传感器(GPS、北斗、伽利略、GLONASS等导航系统终端模块): <pre> 数值型传感器 data.txt 格式如下: { "timestamp":"2012-03-15T16:13:14", "value":294.34 } 地理位置型传感器 data.txt 格式如下: { "timestamp":"2012-03-15T16:13:14", "value":{"lat":40.0207,"lng":115.2614,"alt":2000} } </pre> 一个设备的所有传感器数据批量上传: <pre> POST /v1/device/1/datapoints HTTP/1.1 Accept: */* x-key: asdf1234 Content-Length: 125 Content-Type: text/html [{"sensor_id":1,"value":17.2},{"sensor_id":2,"value":{"lat":40.0207,"lng":115.2614,"alt":2000},{"sensor_id":3,"value":19.2}] </pre> <br><br> === View === <br> {| border="0" width=650 cellspacing="1" cellpadding="8" align="left" bgcolor=#1b74c2 | style="background:#dee7ec" width=80| URL | style="background:#ffffff" | http://api.easyhomelink.org/v1/device/DEV_ID/sensor/SEN_ID/datapoint/KEY |- | style="background:#dee7ec" | Formats | style="background:#ffffff" | JSON |- | style="background:#dee7ec" | Methods | style="background:#ffffff" | GET |- | style="background:#dee7ec" | Returns | style="background:#ffffff" | 设备信息 |} 返回传感器的最新数据: data.txt (最后一行是空行) <pre> GET /v1/device/1/sensor/1/datapoint HTTP 1.1 Accept: */* x-key: asdf1234 Content-Length: 0 Content-Type: text/html </pre> <pre> cat data.txt | netcat easyhomelink.org 3000 </pre> <pre> curl --request GET --header "x-key: YOUR_UUID" http://api.easyhomelink.org/v1/device/1/sensor/1/datapoint </pre> 返回传感器的所有数据: data.txt <pre> GET /v1/device/1/sensor/1/datapoints HTTP/1.1 Accept: */* x-chart: 1 x-key: asdf1234 Content-Length: 0 Content-Type: text/html </pre> <pre> curl --request GET --header "x-key: YOUR_UUID" http://api.easyhomelink.org/v1/device/1/sensor/1/datapoints </pre> 返回传感器 20120712T11:30:20 时的数据: <pre> curl --request GET --header "x-key: YOUR_UUID" http://api.easyhomelink.org/v1/device/1/sensor/1/datapoint/20120712T11:30:20 </pre> <br><br> === Update === <br> {| border="0" width=650 cellspacing="1" cellpadding="8" align="left" bgcolor=#1b74c2 | style="background:#dee7ec" width=80| URL | style="background:#ffffff" | http://api.easyhomelink.org/v1/device/DEV_ID/sensor/SEN_ID/datapoint/KEY |- | style="background:#dee7ec" | Formats | style="background:#ffffff" | JSON |- | style="background:#dee7ec" | Methods | style="background:#ffffff" | PUT |- | style="background:#dee7ec" | Returns | style="background:#ffffff" | 无 |} <br><br> === Delete === <br> {| border="0" width=650 cellspacing="1" cellpadding="8" align="left" bgcolor=#1b74c2 | style="background:#dee7ec" width=80| URL | style="background:#ffffff" | http://api.easyhomelink.org/v1/device/DEV_ID/sensor/SEN_ID/datapoint/KEY |- | style="background:#dee7ec" | Formats | style="background:#ffffff" | 无 |- | style="background:#dee7ec" | Methods | style="background:#ffffff" | DELETE |- | style="background:#dee7ec" | Returns | style="background:#ffffff" | 无 |} <br><br>
返回到
Cloud Of Things API
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面