Endpoints
Contents
This section describes the available API endpoints and how to access and expose them.
Draft and master
The Guillotine application exposes two endpoints per content project:
-
/site/<project-name>/draft
- draft items -
/site/<project-name>/master
- published items
As an example, when running the Enonic SDK on your local machine, you may access the items of a project called blog
, using the following URLs:
-
http://localhost:8080/site/blog/draft
- Drafts API -
http://localhost:8080/site/blog/master
- Live API
The endpoints handle both POST
and GET
methods, but GET
method is only applicable for Subscriptions
via WebSockets.
Custom domain
When setting up Enonic XP in production, the APIs will normally not be publicly accessible. Using Vhosts, you may expose the APIs and even providing custom domain names:
Examples for a project called myproject
.
mapping.my-api.host = myapi.com
mapping.my-api.source = /
mapping.my-api.target = /site/myproject/master
mapping.my-api.host = example.com
mapping.my-api.source = /api
mapping.my-api.target = /site/myproject/draft
For more details about vhosts, check out the XP documentation
Starting from version 6.2.0, the Guillotine exposes a new GET /site/<project-name>
endpoint to provide a query playground with GraphiQL UI, which can be enabled or disabled via config file com.enonic.app.guillotine.cfg
To enable the endpoint:
queryplayground.ui.mode=on
To disable the endpoint:
queryplayground.ui.mode=off
The default value is determined by the XP distribution type: on server-based distributions the endpoint is off, while on SDK-based distributions it is on.