Skip to the content
Documentation

Step 1: Understanding the REST URI pattern

No ratings yet

Every REST address has the same shape:

https://www.example.com/api/ezp/v2/content/node/2
                       |    |   |  |
                       |    |   |  the route of the provider
                       |    |   the version (v + a number; optional for a provider that has unversioned routes)
                       |    the provider prefix
                       rest.ini [System] ApiPrefix
  • The API prefix, rest.ini [System] ApiPrefix (/api), tells the web server and the kernel that the request is for the REST interface (index_rest.php).
  • The provider prefix selects the provider class from rest.ini [ApiProvider] ProviderClass[<prefix>]: ezp (content, ezprestapi), auth (OAuth), help, graphql, migration.
  • The version, v1, v2 and so on, selects the routes registered for that version.
  • The route is matched against the provider's routes. Rails-style routes name their variables with a colon (/content/node/:nodeId); regular expression routes use named groups.

The splitting is done by the prefix filter, rest.ini [System] PrefixFilterClass=ezpRestDefaultRegexpPrefixFilter. A query string carries options such as ResponseGroups and OutputFormat.

Next: Step 2: understanding REST API versioning.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.