Request Examples

The following section includes examples of typical Content API requests. Please feel free to use or adapt them in your own integrations.

The requests are split into sections that relate to a specific product, or all the products.

For more information about the products please see this page - Products

All Products

Latest news stories

To return a list of stories from the News service, ordered by the time they were first published (latest first) make the following request:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/service/paservice:news/item?sort=firstcreated:desc"

Latest UK news stories, in Atom format

To return a list of stories in Atom format from the UK News service, ordered by the time they were first published (latest first) make the following request:

curl \
  -H "Accept: application/atom+xml" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/service/paservice:news:uk/item?sort=firstcreated:desc"

If you don't have control over you HTTP request headers, simply pass extra query parameters as follows:

curl \
  "https://content.api.pressassociation.io/v1/service/paservice:news:uk/item?sort=firstcreated:desc&accept=atom&apikey=<API KEY>"

Latest "royal news" stories, in RSS format

To return a list of stories in RSS format from the News service tagged with the "royal" subject, ordered by the time they were first published (latest first) make the following request:

curl \
  -H "Accept: application/atom+xml" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/service/paservice:news:uk/item?sort=firstcreated:desc&subject=tag:royal"

If you don't have control over you HTTP request headers, simply pass extra query parameters as follows:

curl \
  "https://content.api.pressassociation.io/v1/service/paservice:news:uk/item?sort=firstcreated:desc&subject=tag:royal&accept=rss&apikey=<API KEY>"

Latest sport news

To return a list of stories from the Sport service, ordered by the time they were first published (latest first) make the following request:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/service/paservice:sport/item?sort=firstcreated:desc"

Recently updated football stories

To return a list of stories from the Football service, ordered by the time they were last updated (latest first) make the following request (note: by default the API sorts by last updated, or "versioncreated"):

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

Recently updated football stories about the English Premier League

To return a list of stories from the Football service about the English Premier League, ordered by the time they were last updated (latest first) make the following request (note: by default the API sorts by last updated, or "versioncreated"):

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
 "https://content.api.pressassociation.io/v1/service/paservice:sport:football/item?subject=competition:pafootball:100"

Recently updated football stories about Manchester United

To return a list of stories from the Football service about the Manchester United, ordered by the time they were last updated (latest first) make the following request (note: by default the API sorts by last updated, or "versioncreated"):

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
 "https://content.api.pressassociation.io/v1/service/paservice:sport:football/item?subject=club:pafootball:12"

Recently updated boxing stories

To return a list of stories from the Sport service about Boxing, ordered by the time they were last updated (latest first) make the following request (note: by default the API sorts by last updated, or "versioncreated"):

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
 "https://content.api.pressassociation.io/v1/service/paservice:sport/item?subject=sport:boxing"

You can perform this particular query against many different sports. To find out which sports are available within Content API simply run the following request:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
 "https://content.api.pressassociation.io/v1/subject?profile=sport"

Stories from this day last year

To return a list of stories from the that were published on this day last year make the following request:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/item?start=now-1y-1d&end=now-1y"

If you'd like to go back even further simply change the "1y" parameter to another year (e.g. 3 or 4).

Ready specific examples

Top news stories in the previous 36 hours

To return a list of stories from the News service, published within the previous 36 hours, ordered by their "ranking" (or significance) date and the time they were first published (latest first) make the following request:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/service/paservice:news/item?sort=ranking:asc&sort=firstcreated:desc&start=now-36h"

Top 10 stories from the previous 24 hours across all services

To return a list of the "top 10" stories from all subscribed services, published within the previous 24 hours, ordered by their "ranking" (or significance) date and the time they were first published (latest first) make the following request:

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/item?sort=ranking:asc&sort=firstcreated:desc&limit=10&start=now-24h"

Latest stories from the Sci-Tech Technology service

To return a list of stories from the Sci-Tech Technology service, ordered by the time they were first published (latest first) make the following request:

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

Filter out specific Embeds

When accessing a specific item from the Content API you can request that certain embeds are removed from the body html. This can be requested per-provider of the embeds.

๐Ÿ“˜

Ready / Collections

This mostly applies to PA Ready or Collections content, as Create does not feature embeds in the body html.

For Now & Create you can filter out social items or social items for specific providers.

This filter is particularly useful for filtering out embeds that have been deemed unsafe for GDPR reasons.

From our assessment the providers that are potentially unsafe are

  • Youtube
  • Instagram
  • Facebook
  • Giphy

Multiple providers can be filtered out of the same request by repeating the parameter. To filter out all of the above, add the following to your request - &excludeEmbedType=youtube&excludeEmbedType=instagram&excludeEmbedType=facebook&excludeEmbedType=giphy

Here is an example request that filters them all out.

curl \
  -H "Accept: application/json" \
  -H "apikey: <API KEY>" \
  "https://content.api.pressassociation.io/v1/service/paservice:news/item?excludeEmbedType=youtube&excludeEmbedType=instagram&excludeEmbedType=facebook&excludeEmbedType=giphy"