Skip to the content
Documentation

Rest API

No ratings yet

Exponential 6 has a REST interface for reading and writing content from other applications: mobile apps, other sites, scripts. It answers JSON below /api, with OAuth 2.0 tokens or personal API keys, and checks every call against the user's roles and policies, like the administration does.

What serves what

  • The REST framework is in the kernel (kernel/private/rest/, settings/rest.ini): routing, versions, authentication, the answer cache, output renderers. The entry point is index_rest.php; the shipped .htaccess_root sends /api/ to it.
  • The content API is the extension ezprestapi, which a new installation activates. It answers at /api/ezp/v1/... (read only, the API existing clients use) and /api/ezp/v2/... (also create and remove).
  • OAuth is in the kernel: applications are registered on Setup > oAuth admin, users authorize them on /oauth/authorize, and tokens come from /api/auth/v1/oauth/token.
  • Other providers of the kernel use the same framework: the help (/api/help/...), GraphQL (/api/graphql/...) and the migrations status (/api/migration/...).

A first call

export EXP_API_KEY='expk_...'   # a personal API key (My account > API access)
curl -s -H "Authorization: Bearer $EXP_API_KEY" https://www.example.com/api/ezp/v1/content/node/2

The pages of this section

Related pages

In this section

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.