我想每1分钟进行一次消耗测量,但是每隔15分钟就从我的Option Cloudgate上传到QuarkIoE。因此,总共需要上传15个测量值,每个测量值都有自己的值和时间戳。
这可能吗?
答案 0 :(得分:0)
如果您使用的是SmartREST,则只需在请求中放置多行。但是也可以通过JSON REST实现(目前仅用于测量)
不幸的是,官方文档中缺少它。
REST请求如下所示:
POST /measurement/measurements
Content-Type: application/vnd.com.nsn.cumulocity.measurementCollection+json
{
"measurements": [
{
"c8y_SpeedMeasurement": {
"speed": {
"value": 25,
"unit": "km/h" }
},
"time":"2013-06-22T17:03:14.000+02:00",
"source": {
"id":"10200" },
"type": "c8y_SpeedMeasurement"
},
{
"c8y_SpeedMeasurement": {
"speed": {
"value": 22,
"unit": "km/h" }
},
"time":"2013-06-22T17:05:14.000+02:00",
"source": {
"id":"10200" },
"type": "c8y_SpeedMeasurement"
}
]
}
因此格式与查询测量集合时的格式相同。 重要的部分是Content-Type标头。你不能使用application / json,因为它需要一次测量。