This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Learn » eZ Publish » Building native mobile applications...

Building native mobile applications with the eZ Publish REST API

Thursday 13 October 2011 4:21:48 pm

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

eZ Publish REST interface

In short, a REST-ful architecture supports server responses to client requests. The most popular and relevant model in our case is where the client makes an HTTP request to a REST web service URL.

The REST API for eZ Publish seeks to make the content and the features of an eZ Publish installation available to external clients. The first phase of development centers around providing read-only access to the data within the installation, and for ways to easily extend the REST interface with custom functionality.

The REST interface is bundled with eZ Publish 4.5.0. If you wish to use it, you need to make the the REST endpoint, index_rest.php, available via rewrite rules. Conversely, if you prefer to not expose this functionality, you need to make sure that this file is not exposed in your rewrite rules, either via .htaccess files, or the virtual host configuration.

The installation process is well documented in the official eZ Publish documentation. Refer to the “Installation” section of the “Rest API” chapter.

 

Configuration

The eZ Publish REST interface supports various authentication mechanisms. For demonstration and development purposes, we will disable authentication in order to make the REST resources easily accessible. To do so, create the file settings/override/rest.ini.append.php with the following settings:

<?php /*
[Authentication]
RequireAuthentication=disabled
*/ ?>
 

You can then test that the API is accessible by going to http://www.example.com/api/ezp/content/node/2/list. The output at this URL should prompt you to download a JSON-encoded file with data about the child nodes under node 2 -- something we will use in our example applications.

For more information on the eZ Publish REST API URL format, see the documentation. Also see the list of services page for more details on what kind of data fetches can already be performed with the eZ Publish REST API.

 
36 542 Users on board!

Tutorial menu

Printable

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

Author(s)

Proudly Developed with from