fiware - Orion JSON错误请求

我目前正在尝试订阅OrionCosmos。发送到Orion的所有数据均得到更新,没有任何问题。但是,当发布到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上下文代理版本为0.26.1。

先感谢您。

最佳答案

考虑到使用curl发送时,相同的有效负载可以正常工作(请参见此execution session),我倾向于认为客户端中的某些问题(可能被编程框架隐藏了)是造成此问题的原因。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。原文地址:https://stackoverflow.com/questions/34730683/                                                             

       

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值