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

REST and JSON APIs

The API layers of Exponential for developers who build APIs with API Platform, Laravel API resources, Django REST framework or Spring controllers - the REST content API at v1 and v2 with API keys and OAuth2, your own…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/web-framework-developers/rest-and-json-apis.md

On this page

REST and JSON APIs

This page is for developers who expose JSON from controllers or an API framework. Exponential has three ready API layers and the option of plain JSON from a module view. Pick the layer by who calls it.

Contents

  1. Which layer
  2. The REST content API
  3. Your own REST routes
  4. ezjscore server functions
  5. expservices
  6. Plain JSON from a view
  7. Compared with API frameworks

Which layer

CallerLayerAuthentication
Other programs reading or writing content: apps, front ends, integrationsREST v1 and v2 (ezprestapi)personal API keys, OAuth2
Your own pages' JavaScriptezjscore server functionsthe session, form token for writes
Scripts and apps driving the administration's functionsexpservicesAPI tokens
One small endpoint of your moduleJSON from a module viewthe session or your own check

The REST content API

Relative to /api/ezp/<version> (REST API v1 and v2 for applications):

MethodPathv1v2
GET/content/node/<id>yesyes
GET/content/node/<id>/list(/offset/<n>)(/limit/<n>)yesyes
GET/content/object/<id>, .../fields, .../field/<identifier>yesyes
POST/content/node/createnoyes
DELETE/content/node/delete/<id>noyes
curl -s -H "Authorization: Bearer $EXP_API_KEY" https://example.com/api/ezp/v1/content/node/2

Every call checks the user's policies (content/read, content/create, content/edit, content/remove), whatever the credential. settings/rest.ini configures the framework; [Authentication] RequireAuthentication=enabled is the default. Under Apache with FastCGI, make sure the Authorization header reaches PHP (REST API v1 and v2 guide, OAuth and API keys).

Your own REST routes

An extension adds routes with a REST provider registered for a prefix, with a route table and controllers, the way ezprestapi registers ezp7xRestApiProvider for ezp and ezpl. Route, request, result and response filters are further extension points (Extension points: REST provider). The framework authenticates; your controller must authorize.

ezjscore server functions

# extension/expdemo/settings/ezjscore.ini.append.php
<?php /* #?ini charset="utf-8"?
[ezjscServer_expdemo]
Class=expDemoServerFunctions
*/ ?>

<root>/ezjscore/call/expdemo::count::42?ContentType=json calls expDemoServerFunctions::count( array( '42' ) ) and wraps the return value as {"error_text": "", "content": ...}. ezjscore/call does not check a policy by itself: every function checks for itself (JSON endpoints with ezjscore).

expservices

expservices turns the administration's functions into over a thousand named services (content, users, roles, caches, cronjobs, shop, feeds, media, tags, layouts, the audit and more), called through ezjscore with one answer envelope, discovery and tokens (Remote services with expservices).

Plain JSON from a view

header( 'Content-Type: application/json; charset=utf-8' );
echo json_encode( array( 'ok' => true, 'data' => $data ) );
eZExecution::cleanExit();

Fine for one endpoint; for anything larger use a layer above (Responses).

Compared with API frameworks

FeatureAPI Platform, DRF, Laravel API resourcesExponential
Resources from modelsgeneratedthe content API covers content; your own resources are routes of a REST provider
Serializationserializers, resourcesyour controller builds arrays; REST returns fields, optionally rendered as XHTML
OpenAPI documentationgeneratednot generated
GraphQLavailable as packagesnot in Exponential 6; the Symfony platform products have it (The platform products)
Authenticationtokens, OAuthAPI keys, OAuth2, expservices tokens

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x