首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Orion JSON错误请求

Orion JSON错误请求
EN

Stack Overflow用户
提问于 2016-01-12 04:42:41
回答 1查看 181关注 0票数 3

我现在正在试着订阅猎户座和宇宙。发送到猎户座的所有数据正在进行更新,没有任何问题。但是,当我发布到http://xxx.xxx.xx.xx:1026/v1/subscribeContext时,我得到了以下错误:

代码语言:javascript
复制
{
  "subscribeError": {
    "errorCode": {
      "code": "400",
      "reasonPhrase": "Bad Request",
      "details": "JSON Parse Error"
    }
  }
}

这是我发送的json字符串:

代码语言:javascript
复制
{
  "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的实体为:

代码语言:javascript
复制
{
  "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。

提前谢谢你。

EN

回答 1

Stack Overflow用户

发布于 2016-01-26 00:55:49

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34730683

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档