Skip to content
Jose M. Cantera edited this page Oct 4, 2018 · 7 revisions
  • All tests that provide JSON-LD content shall have the Content-Type header set to “application/ld+json” i.e.

orionCurl --url /ngsi-ld/v1/entities -X POST --payload "$payload" -H "Content-Type: application/ld+json”

Note: When JSON-LD content is provided in a request payload the @context member is mandatory. Literally from the specification:

If the request verb is POST or PATCH and the Content-Type header is "application/ld+json", then the associated @context shall be obtained from the input payload itself. If no @context can be obtained from the input payload, then an HTTP error response of type BadRequestData shall be raised.

For the time being I would suggest you deal only with JSON-LD content, but in any case it would be needed to support also JSON content. (application/json). And in that case the @context shall be obtained from the JSON-LD Link header.

  • When creating an Entity in the response (201 created) is not needed to add any Link header, so that would need to be removed.

  • As per our discussion yesterday the resulting location header should have percent-encoded the entity id i.e. it should be

Location: /ngsi-ld/v1/entities/http%3A%2F%2Fa.b.c%2Fentity%2FE3

FAQ

  1. Is it ld+json or json+ld? Never seen ld+json before ...

https://www.w3.org/TR/json-ld/#iana-considerations

  1. About the uri encoding of the entity id ... What do I store in mongo? URI-encoded as it comes or should I replace %xxxx to ASCII ?

The best way it allows you to do the query later ... while keeping consistency i.e. in the JSON body the id should appear as it is, i.e. not percent-encoded.

  1. Everything about URI Expansion might be covered but I would still want to have a simple list of order as of how to find the expansions, e.g.:

3.1. First lookup the Attribute name / Type Name / nested Properties of Properties (former metadata), etc.) in the user Context. If found there, expand. If not: 3.2. Use the default expansion {term} -> http://example.org/ngsi-ld/default/{term}

3.3. Exceptions:

A/ 'location'

B/ 'observationSpace'

C/ 'operationSpace'

3.4 For the rest of well-known API terms which are not Attributes ("Property", "Relationship", "value", "object", etc.) do not expand.

Clone this wiki locally