Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Reading the documentation through REST and GraphQL

The documentation site is an ordinary Exponential installation, so its pages can be read by programs as well as by people: through the kernel's REST content API and its GraphQL API. Both read as the anonymous visitor…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/ext/exp_doc/headless-access.md

On this page

Reading the documentation through REST and GraphQL

The documentation site is an ordinary Exponential installation, so its pages can be read by programs as well as by people: through the kernel's REST content API and its GraphQL API. Both read as the anonymous visitor, so they see exactly what the site shows, and nothing that is hidden or restricted.

Contents

  1. What is available
  2. GraphQL
  3. REST
  4. The documentation's content classes
  5. Troubleshooting

1. What is available

InterfaceAddressReads
GraphQL<site>/api/graphqlany field of any documentation page, in one request
REST, version 2<site>/api/ezp/v2/content/node/<node id> and .../list/offset/<n>/limit/<n>a node and its children
REST, version 1<site>/api/ezp/v1/...the same, in the older format

<site> is the documentation's address, for example https://doc.exponential.earth. Both interfaces have to be switched on in the installation (see section 5); they only read here. Pages are never changed through them on this site.

2. GraphQL

The schema is generated from the content classes: every class is a type, every attribute a field. A query for a page and its children:

query {
  node(id: 2535) {
    name
    url
    children(limit: 20) {
      name
      url
      contentClass
    }
  }
}

Send it with any HTTP client:

curl -s https://doc.exponential.earth/api/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ node(id: 2535) { name url children(limit: 20) { name url } } }"}'

The kernel limits the depth, the complexity and the list sizes of a query; ./console exp:graphql:status shows the limits. The full reference is the kernel's help page The GraphQL API (features/6.0/graphql.md), with a walkthrough and recipes.

3. REST

curl -s https://doc.exponential.earth/api/ezp/v2/content/node/2535
curl -s https://doc.exponential.earth/api/ezp/v2/content/node/2535/list/offset/0/limit/20

Reads answer at version 1 and version 2 and check the reader's policies, as the site does. The guide is the kernel's help page REST API v1 and v2 (guides/rest-api-v1-and-v2.md).

4. The documentation's content classes

ClassWhat it isFields worth reading
exp_doc_pagea pagetitle, body, labels, written_by, last_updated_by, maintainers, contributors, history_of
exp_doc_sectiona section of pagesas a page
exp_doc_manuala manual (Technical, User ...)summary, audience, cover
exp_doc_versiona version of a manualversion, status, released, eol, release_notes
exp_doc_tutorial, exp_doc_tutorial_stepa tutorial and its stepslevel, duration, prerequisites, step_number
exp_doc_faq, exp_doc_faq_questionan FAQ group and one questionquestion, answer
exp_doc_extensionan extension's pageextension_name, repository, packagist, compatibility, license, status
exp_doc_contributora person who wrote, maintains or commented on pagesthe pages that name them, through the relations
exp_doc_historicala container of the page historytitle, history_of
comment_historicala reader's commenttitle, body, author, author_name, created, source_parent_id
exp_doc_image, exp_doc_filean image or a file of the pagesimage or file, alt, caption, credit

5. Troubleshooting

What you seeWhat to do
/api/graphql answers 404, or that GraphQL is offIt is not switched on for the site: ./console exp:graphql:enable --siteaccess=site --apply on the installation.
/api/ezp/... answers 404The REST extension is not active: ActiveExtensions[]=ezprestapi.
An empty result for a page you can seeThe page is hidden, or not in the language asked for.

Something wrong on this page? Report an error

Documentation license

This page is part of the documentation of the extension exp_doc and is distributed under the license of that extension.