Please enable JavaScript to view this site.

PRD_SIS_004_Developer's Guide 2.6

Navigation: Implementation details

Variations on the payload

Scroll Prev Top Next More

REST API support standard and specific features to adapt the payload to the client’s needs for transmission when features are not of use / not implemented in clients:

Features

Example:

Body compression

Direction:Request
Description:The client can send request body for searches on GET, for resources creation or update on POST, PUT, and PATCH.
This request body can be compressed using standard HTTP supported features:

zip

deflate

brotli

Example:POST /accounts

Content-Encoding: gzip

Content-Type: application/LD+JSON

<gzipped resource representation>

Direction:Response
Description:The client can request the response body to be compressed if it supports it.
Example:GET /accounts/12345

Accept-Encoding: gzip

Accept: */*

200 OK

<gzipped resource representation>

Disabling hypermedia generation (Not Yet available)

Direction:Response
Description:The client can request the response not to include hypermedia representation of possible actions (HATEOAS).
This is done by adding a parameter in the query string: modifier[]=no-hypermedia
Example:GET /accounts/123451?modifier=no-hypermedia

200 OK

<Account representation without hypermedia>

Asking for a custom context (Not Yet available)

Direction:Response
Description:When the client cannot implement JSON-LD compaction, it can request the server to provide the JSON-LD representation following a context provided in input.
This is done by adding a parameter in the query string: context[]=<uri of context>

Many contexts could be combined. (Refer to JSON-LD specification)

Example:GET /accounts/123451?context=http://.../mycontext.jsonld

200 OK

<Account representation customized for client>

Asking for local time instead of UTC time (Not Yet available)

Direction:Response
Description:The client can request to have the date-time inside the response converted to a local time.
This is done by adding a parameter in the query string: timezone=<timezone>

Time-zone codes are defined in the tz database:
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Example:GET /accounts/12345?timezone='Europe/Paris'

Asking for specific representations

Direction:Response
Description:Depending on the resource API, the resource can be provided in different layout of its representation.
This is done by adding a parameter in the query string: view=<nameOfView>

Asking for specific format

Direction:Response
Description:Depending on the resource API, the resource can be provided in a different layout of its representation.
This is done by changing the Accept header in the request
Example:GET /parks/123/assets

Accept image/png

PNG image displaying assets of park 123 on a map