Content formats
When performing a REST request, you should specify the format in which the content will be retrieved / added.
Specifying the query argument
Always specify the ?_format
query argument, e.g. GET https://demo.narwhalcms.com/node/1?_format=json
Possible values:
- ?_format=json
- ?_format=hal_json
- ?_format=xml (disabled by default)
Specifying the Content-Type request header
When performing a POST
or PATCH
request, you should also specify the Content-Type
HTTP request header.
E.g. Content-Type: application/json
Possible values:
- Content-Type: application/json
- Content-Type: application/hal+json
- Content-Type: application/xml (disabled by default)
More information about formats
Format | More info |
---|---|
JSON | http://www.json.org/ |
HAL+JSON | http://stateless.co/hal_specification.html |
XML | https://www.w3.org/XML/ |