Content Negotiation

This page will help you understand the different content types provided by Content API and how to content negotiate between them

Depending on your use case it may be necessary to use a specific content types. For example, a mobile or web application would typical require a lightweight JSON response (perhaps utilising Partial Response to further reduce the payload!) whereas integration with a CMS would warrant the usage of an XML based format such as Atom or RSS.

To this end, all endpoints within Content API are capable of returning JSON, ATOM and RSS response types via content negotiation. By default JSON responses will be returned.

📘

IPTC NinJS Complaint

The JSON returned by Content API is based on the IPTC NinJS standard. PA have extended the JSON schema to support additional metadata.

For full details please refer to the NinJS developer site.

JSON

In order to return JSON ensure you set your Accept header to application/json:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  https://content.api.pressassociation.io/v1/item

or, if headers aren't available simply provide an accept query parameter:

curl https://content.api.pressassociation.io/v1/item?accept=json&apikey=<API KEY>

Atom

To return Atom ensure you set your Accept header to application/atom+xml:

curl \
  -H "Accept: application/atom+xml" \
  -H "apikey: <API KEY>" \
  https://content.api.pressassociation.io/v1/item

or, if headers aren't available provide an accept query parameter with the value of atom:

curl https://content.api.pressassociation.io/v1/item?accept=atom&apikey=<API KEY>

RSS

To return RSS ensure you set your Accept header to application/rss+xml:

curl \
  -H "Accept: application/rss+xml" \
  -H "apikey: <API KEY>" \
  https://content.api.pressassociation.io/v1/item

or, if headers aren't available provide an accept query parameter with the value rss:

curl https://content.api.pressassociation.io/v1/item?accept=rss&apikey=<API KEY>