Share » Learn » eZ Publish » Extending eZ Publish’s REST API -...

Extending eZ Publish’s REST API - Developer Preview #2

Friday 24 December 2010 6:45:20 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Step 1 : Installation

Here are the extensions/tarballs you will build off of :

Unpack the first one somewhere, and follow the instructions in the INSTALL file, found at the root of what you just unpacked.

The second tarball above is actually what you should end-up with at the end of this tutorial. We recommend you build it yourself, following the steps below, much better to understand what you are doing. If you are in a super-rush though, 25 minutes away from the Christmas diner (random example), you may want to download it :)

 

Step 2 : Understanding the REST URI pattern

The resource URIs provided by default by the eZ Publish REST extension support the following convention:

/<prefix>/ + <provider>/<version> + /<function>/<params>

For the built-in REST API, the default provider name is “ezp”. The version token is build as “v + integer” for example v1 for REST API version one. The global prefix (first URI part) can be defined in the REST configuration as settings/rest.ini.[System].ApiPrefix.

The RegExp based URI filtering is handled by a default “ezpRestDefaultRegexpPrefixFilter” class implementation where <provider> and <version> data are used for routs filtering. Developers can implement custom filters by implementing the “ezpRestPrefixFilterInterface” in first place and then updating the “rest.ini.[System].PrefixFilterClass” accordingly. Getting implementation ideas out of the “ezpRestDefaultRegexpPrefixFilter” can be a good start.

 
36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)