1
votes

I've created an Orion instance based on orion-psb-image-R4.2 instance in FIWARE Lab, just updated (orion, pep, cygnus) after setting it. It is listening on internet and I have verified connevity and so.

I tried to create a simple instance with this query:

POST http:x.y.w.z:1026/v1/contextEntities/

Headers: Content-Type: application/json Accept: application/json

Body:

{
   "id": "Sala1",
   "type": "Sala",
   "Attributes": [
      {
         "name": "temperatura",
         "type": "float",
         "value": "20"
      },
      {
         "name": "humedad",
         "type": "float",
         "value": "80"
      }
   ]
}

The answer received from the Web server is: 200, OK Date: Fri, 05 Feb 2016 10:34:51 GMT Content-Length: 132 Content-Type: application/json

But the answer from ORION is:

{
   "errorCode": {
      "code": "400",
      "reasonPhrase": "Bad Request",
      "details": "invalid payload: unknown fields"
   }
}

Any idea on what I'm missing?.

Thanks & Regards.

EDIT: Sorry... that's something I already fixed. Somehow I copied it wrongly. The previous error was "json syntax error".
That's fixed. The error I reported remains after writing "attributes" with lower case "a". Any other idea?

POST: HTTP://x.y.w.z:1026/v1/contextEntities/

HEADERS
Content-Type: application/json
Accept: application/json

BODY
{
"id": "Sala1",
"type": "Sala",
"attributes": [
 { 
   "name": "temperature",
   "type": "float",
   "value": "20" 
 },
 { 
   "name": "humidity",
   "type": "float",
   "value": "80" 
 }
]
}

Thanks in advance

1
Daniel, you need to edit your original question, not use the "Answer" to have a discussion. Discussions in StackOverflow are carried on in Comments.Cindy Meister
As you can see in this execution session gist.github.com/fgalan/f97da64f7bb65ecc1da0 I'm using your exact payload with the curl command and everything seems to be ok. Could you do the same exact test (I mean, the same test.sh file, just changing localhost by the actual IP of the CB in your case) and answer to this comment with the result, please?fgalan
Ok. It works now. Once I executed the POST query IN the server itself. I thought I could create the instance remotely by using a REST client or using curl. Now that it is created I can change the values (using POST) and getting the values using (GET) remotely. Thanks for your support & help.D.DIAZ

1 Answers

0
votes

Orion API is case sensitive. Thus, probably the problem is that your payload uses Attributes instead of attributes (i.e. lower-case a).