joser
joser

Reputation: 43

HTTP 400 error on Orion NGSI10 convenience operations

I receive an HTTP 400 error using convenience operations on Orion:

Request:

GET /v1/contextEntities/mydevice 
HTTP/1.1 Host: XXX.XXX.XXX.XXX:1026
Content-Type: application/json 
Accept: application/json
Fiware-Service: myfiwareservice 
Fiware-ServicePath: /
X-Auth-Token:XXXXXXXXXXX

Response:

{      
  "orionError": {
  "code": "400",
  "reasonPhrase": "Bad Request",
  "details": "Sorry, no request treating object found for RequestType /IndividualContextEntity/"
  }
}

I've verified that my entity exists using the regular NGSI10 operation, that works fine.

Upvotes: 4

Views: 366

Answers (1)

The problem arises when the Context Broker is protected with a PEP proxy and it receives a request that:

  • Has the header 'Content-type: application/json'
  • Doesn't have any body

In this case, due to some libraries used, the PEP Proxy forwards the request adding an empty JSON body, that arrives to the Context Broker, causing the error you mentioned.

The solution in this case is to remove the 'Content-type: application/json' header from the requests that do not have any body (typically GET requests).

EDIT: In the above answer we refer to Steelskin PEP implementation. Other PEP implementations could behave differently.

Upvotes: 1

Related Questions