As LUYA is built upon the concept of REST APIs, providing headless access to the database content of LUYA is a no brainer. You can either access the Ngrest APIs or the CMS admin APIs. Since LUYA admin version 1.1.0 we've added the ability to create API-Users and an overview of which endpoints they can request data from:
In order to see the API Users menu make sure to use luya-admin module in version ~1.1.0 and your group has all permissions.
With introduction of Headless System a new API User layer has been introduced. API Users are almost like other users with the following differences:
- The Access Token can be viewed and changed.
- Request can be tracked in order to debug or find bottlenecks.
- Log entries won't be generated by default, as API users might make thousends of entries, depending of the application.
- Access tokens can be revereted.
- API Users are unable to login into the admin area (trough UI)
- None, one or more permission groups can be assigned to an API User.
The PHP Headless Client is the main tool for PHP in order to working with the Admin APIs. Create Data, Read Data, Update Data, common CRUD tasks or upload files into the admin UI.
In addition to the existing APIs for the CMS, we have also made a module which exposes all required CMS data to a public API, see the CMS API Bridge Module. With this module no authorizaion process is required and there are APIs which makes its more easy to consum the data instead of gathering the data by yourself trough the OpenAPI description.
In order to login users with a JWT authentification based on the admin UI users list. So its possible to get tokens for your users in order to make permission based operations with the admin UI Apis. See JWT & SPA Section.
If you build a website with the LUYA CMS but use the headless client to render the content, you may want to configure the preview URL to point to your headless page.
'modules' => [ 'cmsadmin' => [ 'class' => 'luya\cms\admin\Module', 'previewUrl' => 'https://mywebsite/preview/page', ], ]
To extend, improve or speed up your APIs, take a look at NgRest Api guide section.