3

I'm currently trying to subscribe Orion and Cosmos. All data sent to Orion is being updated without any issue. But, when posting to http://xxx.xxx.xx.xx:1026/v1/subscribeContext I'm getting the following error:

{
  "subscribeError": {
    "errorCode": {
      "code": "400",
      "reasonPhrase": "Bad Request",
      "details": "JSON Parse Error"
    }
  }
}

This is the json string I'm sending:

{
  "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"
  ]
}

The entity updating OK in Orion is:

{
  "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"
    }
  ]
}

I've tried with many different examples from readthedocs, and other responses in StackOverflow unsuccessfully.

Which is the correct format? Should I call /subscribeContext before or after updating Orion with /contextEntities?

Orion Context Broker version is 0.26.1.

Thank you in advance.

medaqueno
  • 73
  • 6
  • I have done a quick test based on curl with the verbatim message you are using at it seems to be ok (see https://gist.github.com/fgalan/f0f44d5113fa88e4825a). Could you do the same test in order to check how it goes in your machine, please? – fgalan Jan 13 '16 at 18:20

1 Answers1

0

Taking into account that the same payload works ok when send using curl (see this execution session) I tend to think that some issue in the client (maybe hiden by a programming framework?) is causing the problem.

fgalan
  • 11,732
  • 9
  • 46
  • 89