我尝试向Orion Context Broker实例发送订阅 . 我发送这个JSON:
{
"duration": "P1M",
"reference": "http://130.206.127.23:1026/ngsi10/notifyContext",
"notifyConditions": [
{
"condValues": [
"PT10s"
],
"type": "ONTIMEINTERVAL"
}
],
"entities": [
{
"id": "1.0",
"type": "Capsule",
"isPattern": "false"
}
],
"attributes": [
"temperature"
]
}
我收到了下一条消息:
<subscribeContextResponse>
<subscribeError>
<errorCode>
<code>400</code>
<reasonPhrase>Bad Request</reasonPhrase>
<details>JSON Parse Error: <unspecified file>(1): invalid escape sequence</details>
</errorCode>
</subscribeError>
</subscribeContextResponse>
我在the documentation中放置了它正在使用的所有属性 . 但在网络研讨会Orion Context Broker Webinar - Demo part 2我可以看到名为 Throttling
的其他属性,但我没有在文档中看到 .
我做得不好?
提前致谢 .
1 回答
我已经测试了您的请求(复制粘贴),这是结果(使用Orion 0.17.0) .
命令(您可以检查有效负载是否与您使用的有效负载完全相同):
结果:
因此,我的测试还可以,所以我倾向于认为问题与编码有关,并且它没有显示在您的问题帖子中,例如使用
“
(错误)"
的intead和类似的东西 .EDIT: 另一个常见的问题来源是在"DOS text"中使用包含CB的curl请求的脚本文件(通常是由于使用了DOS / Windows文本编辑器) . 如果您运行
file yourfile.sh
并获得以下内容,则可以轻松检测到这一点而不是以下
解决方案非常简单:将文件转换为"Unix text",例如使用
dos2unix
命令行工具 .