Skip to the content
Documentation

Installation

No ratings yet

On Exponential 6 the REST API needs no installation: the framework is in the kernel, and the content API extension ezprestapi is installed by Composer and activated on every new installation. What a site has to check:

  • The rewrite rule. The .htaccess made from .htaccess_root sends /api/ to index_rest.php:
    RewriteRule ^api/ index_rest.php [L]
    RewriteRule ^index_rest\.php - [L]
    On nginx, send /api/ to index_rest.php the same way.
  • The extension is active. ezprestapi is listed on Setup > Extensions. The older ezprestapiprovider is a deprecated shim that maps to ezprestapi; a site that still activates it keeps working, but should switch.
  • Policies. The users who call the API need the content policies for their calls, and oauth/authorize to authorize OAuth applications. On an upgrade, ./console exp:addoauthauthorizepolicy --apply --allow-root-user grants it to the roles that let users sign in.
  • HTTPS. Tokens and keys travel in a header. rest.ini [Authentication] RequireHTTPS=enabled refuses plain HTTP.

Test with a call such as curl -s https://www.example.com/api/ezp/v1/content/node/2: with the shipped RequireAuthentication=enabled and no credential it answers 401; a page of the site instead means the rewrite rule is missing.

Related pages

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.