ePublishing GraphQL API Reference

This page is an index for a detailed reference of our GraphQL API, as generated from our schema by GraphQL introspection.

Resources

Calling the API

API requests are POST requests to https://<site domain>/query. The site domain can be for either the stage or production site. The Content-Type header must be application/json. The "query" data sent with the post must be in the GraphQL language. The "variables" data must be in JSON. The response to the request will be in JSON.

With the exception of a tokenCreate mutation and a standard introspection query, all queries require an authorization token. To get a token use the tokenCreate mutation (example below), which requires a user email and password. Tokens expire in a configurable amount of time. Include that token in the Authorization header of subsequent queries with the format token <token>.

curl Examples

# create an authorization token
curl \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"query": "mutation { tokenCreate(email: \"<email>\", password: \"<password>\", admin: true) { token expiresAt } }"}' \
  https://<site domain>/query

# read
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: token <token>" \
  --data '{"query": "query { articles(perPage: 2) { id title } }"}' \
  https://<site domain>/query

# write
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: token <token>" \
  --data '{"query": "mutation { articleUpdate(input: { ids: \"MWUtNjc=\", title: \"foo\" }) { articles { id title } } }"}' \
  https://<site domain>/query

# read with variables
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: token <token>" \
  --data '{"query": "query ($perPage: Integer) { articles(perPage: $perPage) { id title } }", "variables": "{ \"perPage\": 2 }" }' \
  https://<site domain>/query

To convert these into other languages see curlconverter or curl-to-ruby.