我现在正在试着订阅猎户座和宇宙。发送到猎户座的所有数据正在进行更新,没有任何问题。但是,当我发布到http://xxx.xxx.xx.xx:1026/v1/subscribeContext时,我得到了以下错误:
{
"subscribeError": {
"errorCode": {
"code": "400",
"reasonPhrase": "Bad Request",
"details": "JSON Parse Error"
}
}
}这是我发送的json字符串:
{
"entities": [
{
"type": "Location",
"isPattern": "false",
"id": "Device-1"
}
],
"reference": "http://52.31.144.170:5050/notify",
"duration": "PT10S",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"position"
]
}
],
"attributes": [
"position"
]
}Orion中更新OK的实体为:
{
"type": "Location",
"isPattern": "false",
"id": "Device-1",
"attributes": [
{
"name": "position",
"type": "coords",
"value": "24,21",
"metadatas": [
{
"name": "location",
"type": "string",
"value": "WGS84"
}
]
},
{
"name": "id",
"type": "device",
"value": "1"
}
]
}我从readthedocs中尝试了许多不同的示例,并在StackOverflow中尝试了其他响应,但都没有成功。
哪种格式是正确的?我应该在用/contextEntities更新Orion之前还是之后调用/subscribeContext?
Orion Context Broker版本为0.26.1。
提前谢谢你。
发布于 2016-01-26 00:55:49
考虑到相同的有效负载在使用curl发送时工作正常(请参阅此execution session),我倾向于认为客户端中的某些问题(可能被编程框架隐藏了?)是导致问题的原因。
https://stackoverflow.com/questions/34730683
复制相似问题