在我想更新值和元数据的情况下,如果我没有在请求体中设置属性类型,它会将属性类型更新为“none”,我将丢失信息 .
我不确定它是否应该发生 . 此 endpoints 不允许PATCH请求 .
e.g.:
我有一个叫温度的属性,它的类型是'cassius' .
PUT http:// localhost:1026 / v2 / entities / Room1 / attrs / temperature?type = Room
身体:
{
"value": 20,
"metadata":{"han":"solo"}
}
用cURL表示:
curl -X PUT -H "Fiware-Service: teste_1" -H "Content-Type: application/json" -d '{
"value": 20, "metadata":{"han":"solo"}
}' "http://localhost:1026/v2/entities/Room1/attrs/temperature?type=Room"
在此请求之后,原始属性类型已消失,因为它已设置为“none”,因为它在请求主体上不存在时设置为none .
PS:我没有测试过text / plain内容类型 .
猎户座上下文代理信息:
{
"orion" : {
"version" : "1.2.0-next",
"uptime" : "9 d, 17 h, 27 m, 37 s",
"git_hash" : "c1a224db08086751f05d471a8b52c0eaec15f3a5",
"compile_time" : "Thu Aug 4 09:04:12 BRT 2016",
"compiled_by" : "root"
}
}
1 回答
如果您执行PUT,则替换整个属性,并且实现将类型重置为“none” .
尝试仅更新值和类型将保留 .
http://localhost:1026/v2/entities/Room1/attrs/temperature/value