Skip to content
Jetrepo
Esc
navigateopen⌘Jpreview
On this page

Fetch content

Make and verify GraphQL and REST requests for published content.

Use server-side code and a key with delivery.readPublished scoped to the intended Backend. The article model key below is illustrative; replace it with a Data Type key from your Backend.

Creating a key requires apiKey.create. Listing key metadata and policy requires apiKey.read. The runtime key does not also require backend.read.

Query GraphQL

curl https://delivery.example.com/graphql \
  -H 'content-type: application/json' \
  -H 'x-api-key: YOUR_DELIVERY_KEY' \
  --data '{"query":"{ article_all(first: 1) { items { _id title } } }"}'
{
  "data": {
    "article_all": {
      "items": [{ "_id": "018f-example", "title": "Hello Jetrepo" }]
    }
  }
}

Query REST

curl 'https://delivery.example.com/rest/article?first=1' \
  -H 'x-api-key: YOUR_DELIVERY_KEY'
{
  "items": [{ "_id": "018f-example", "title": "Hello Jetrepo" }],
  "total_count": 1,
  "page_info": {
    "has_next_page": false,
    "has_previous_page": false,
    "start_cursor": "CURSOR",
    "end_cursor": "CURSOR"
  }
}

Both responses should identify the same Published record. Missing or invalid keys return 401; unresolved or disallowed Backend scope returns 403. Revocation affects later requests.

Was this page helpful?