![](/img/trans.png)
[英]Attribute Reference for subscription in Orion Context Broker Fiware
[英]Subscription in Orion Context Broker Fiware
我尝试向我的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>
我将它正在使用的所有属性都放在文档中 。 但是在网络研讨会Orion Context Broker网络研讨会-演示第2部分中,我可以看到称为Throttling
其他属性,但是在文档中却没有看到。
我在做什么不好?
提前致谢。
我已经测试了您的请求(复制粘贴),这就是结果(使用Orion 0.17.0)。
命令(您可以检查有效载荷是否与您使用的有效载荷完全一样):
(curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
"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"
]
}
EOF
结果:
{
"subscribeResponse": {
"duration": "P1M",
"subscriptionId": "5489e0bfe5007d3271ab5a61"
}
}
因此,我的测试还可以,所以我倾向于认为问题与编码有关,并且未在您的问题中显示,例如, “
(错误的)intead的用法"
东西。
编辑:问题的另一个常见来源是使用脚本文件,该脚本文件包含“ DOS文本”中CB的curl请求(通常是由于使用DOS / Windows文本编辑器)。 如果运行file yourfile.sh
并获取以下内容,则可以轻松检测到此问题
yourfile.sh: ASCII text, with CRLF line terminators
代替以下
yourfile.sh: ASCII text
解决方案非常简单:例如使用dos2unix
命令行工具将文件转换为“ Unix文本”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.