ezsystems/ezplatform-rest
Adds a REST remote API to Ibexa DXP and Ibexa Open Source, enabling external clients to interact with Ibexa content and services. Includes official REST API reference and documentation links for usage and endpoints.
Installation:
composer require ezsystems/ezplatform-rest
Ensure your config/bundles.php includes Ibexa\Rest\IbexaRestBundle.
Enable REST API:
Add the bundle to your config/packages/ibexa_rest.yaml (auto-generated if missing):
ibexa_rest:
enabled: true
security:
firewalls:
- main
First Use Case: Test the API by accessing the content endpoint:
curl -X GET http://your-site.com/api/ezplatform/v2/content -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
(Obtain tokens via /api/ezplatform/v2/jwt/login with valid credentials.)
Content Management:
curl -X POST http://your-site.com/api/ezplatform/v2/content -H "Content-Type: application/json" -d '{"name": "Test", "contentInfo": {"mainLocationId": 2}}'
curl -X GET http://your-site.com/api/ezplatform/v2/content/123?fields=title,body
Authentication:
curl -X POST http://your-site.com/api/ezplatform/v2/jwt/login -d '{"username": "admin", "password": "password"}'
Authorization: Bearer <token> in headers.Search:
curl -X GET "http://your-site.com/api/ezplatform/v2/search?query=test&limit=10"
Media Handling:
curl -X POST http://your-site.com/api/ezplatform/v2/content/123/fields/image -H "Content-Type: image/jpeg" --data-binary "@image.jpg"
/api/ezplatform/v2/.
Example:
# config/routes.yaml
api_custom:
path: /api/ezplatform/v2/custom
controller: App\Controller\CustomApiController::index
ibexa.rest.field_type.processor services.
# config/services.yaml
services:
App\Rest\FieldType\CustomFieldProcessor:
tags:
- { name: ibexa.rest.field_type.processor, fieldType: 'ezrichtext' }
Authentication Issues:
ezpublish_rest_session is configured in your firewall (see IBX-6239).config/packages/security.yaml:
firewalls:
main:
pattern: ^/api/ezplatform
stateless: true
ezpublish_rest_session:
provider: ezpublish_rest_auth_provider
Field Serialization:
ibexa.rest.field_type.processor tag.var/log/dev.log for FieldTypeProcessor errors.Deprecated Services:
ezpublish_rest.field_type_processor (deprecated in v1.3.2). Use ibexa.rest.field_type.processor instead.Empty Responses:
/languages/{code} may return 404 if the language doesn’t exist. Validate codes first:
curl -X GET http://your-site.com/api/ezplatform/v2/languages
Enable API Debug Mode:
# config/packages/ibexa_rest.yaml
ibexa_rest:
debug: true
Logs detailed requests/responses to var/log/ibexa_rest.log.
Postman Collection: Import the Ibexa REST API Postman Collection for testing.
Custom Criteria:
Extend search with DateMetadataCriterion (added in v1.3.4):
// In a custom controller
$criterion = new DateMetadataCriterion();
$criterion->setDateRange('2023-01-01', '2023-12-31');
$searchService->findContent($criterion);
CSRF Protection:
Disable for specific endpoints in config/packages/security.yaml:
access_control:
- { path: ^/api/ezplatform/v2/unsafe-endpoint, roles: PUBLIC_ACCESS }
Performance:
?fields=... to limit payload size.ezplatform_rest.cache (Symfony Cache component).How can I help you explore Laravel packages today?