FIWARE / context.Orion-LD

Context Broker and CEF building block for context data management which supports both the NGSI-LD and the NGSI-v2 APIs
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf
GNU Affero General Public License v3.0
50 stars 41 forks source link

Unsupported parameters should return BadRequest #407

Open jason-fox opened 4 years ago

jason-fox commented 4 years ago

Related: https://github.com/ScorpioBroker/ScorpioBroker/issues/71

According to the specification - 6.5.3.1 , only attrs is a supported parameter for `http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:xxx/

I create a Store

curl -X POST \
  'http://localhost:9090/ngsi-ld/v1/entities/' \
  -H 'Content-Type: application/ld+json' \
  -d '{
    "id": "urn:ngsi-ld:Building:store001",
    "type": "Building",
    "category": {"type": "Property", "value": ["commercial"]},
    "address": {
      "type": "Property", 
      "value": {"streetAddress": "Bornholmer Straße 65", "addressRegion": "Berlin", "addressLocality": "Prenzlauer Berg", "postalCode": "10439"},
      "verified": {"type": "Property", "value": true}
    },
    "location": {"type": "GeoProperty", "value": {"type": "Point", "coordinates": [13.3986, 52.5547]}
    },
    "name": {"type": "Property", "value": "Bösebrücke Einkauf"},
    "furniture": {
      "type": "Relationship", "object": [ "urn:ngsi-ld:Shelf:unit001", "urn:ngsi-ld:Shelf:unit002", "urn:ngsi-ld:Shelf:unit003"]
    },
    "@context": "https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld"
}'

I retrieve the Store using the type parameter

curl -L -X GET 'http://localhost:9090/ngsi-ld/v1/entities/urn:ngsi-ld:Building:store001/?type=Building' \
-H 'Link: <https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Content-Type: application/ld+json'

Response should say that this is an invalid request.

{
    "type":"http://uri.etsi.org/ngsi-ld/errors/InvalidRequest",
    "title":"Invalid request.",
    "details":"Invalid request."
}
kzangeli commented 4 years ago

Sure, some day we'll implement this too ...