Installation
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:
On nginx, send /api/ to index_rest.php the same way.RewriteRule ^api/ index_rest.php [L] RewriteRule ^index_rest\.php - [L]
- 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
- REST API v1 and v2: one extension, sections 6 and 7 (migrating from ezprestapiprovider)
Contributors
- Geir Arne Waaler
- Graham Brookins Updated Maintainer
Comments
Add a comment