猎户座JSON不良请求

时间:2016-01-11 20:42:41

标签: fiware fiware-orion fiware-cygnus

我目前正在尝试订阅Orion和Cosmos。发送给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 Context Broker版本为0.26.1。

提前谢谢。

1 个答案:

答案 0 :(得分:0)

考虑到使用curl发送时相同的有效负载工作正常(请参阅此execution session)我倾向于认为客户端中的某些问题(可能是由编程框架隐藏?)导致问题。< / p>