Issue
We are using the Liferay Headless API method getContentStructureStructuredContentsPage
of headless-delivery
-
/o/headless-delivery/v1.0/content-structures/<structure-id>/structured-contents
To get a web content filtering by a custom field of the structure:
-
contentStructureId:
<id from DDMStucture>
-
filter:
contentFields/my_custom_field eq 'value'
The problem with this API method is it only returns web contents that are in approved status, so you cannot get the web contents that are in scheduled status.
How can we get the information of a web content that is in scheduled status?
Environment
- DXP 7.4
- Liferay 2024.Q1
-
Quarterly Releases
Resolution
The API method getContentStructureStructuredContentsPage
of headless-delivery only returns the web contents that are in approved status by design, so you cannot use this API to get the required information.
To get the draft and scheduled versions of a web content, you can use the API method getSiteStructuredContentsPage
of headless-admin-content:
-
/o/headless-admin-content/v1.0/sites/<group-id>/structured-contents
To get information about this API go to: http://localhost:8080/o/api?endpoint=http://localhost:8080/o/headless-admin-content/v1.0/openapi.json, or after opening the API Explorer, select "headless-admin-content/v1.0" in the REST application dropdown.
However, using this API is not possible to filter by a specific field. This was requested as a feature request, for more information see: LPD-35385
As an alternative, you could set up a search blueprint to execute the search by a specific field and then use the search headless API to execute the search, for more information on this approach, see: How to set up Search Blueprints to be used with Search headless API
Additional Information
- How to filter web content by structure field with headless APIs
- How to set up Search Blueprints to be used with Search headless API
- Headless Delivery API - Filtering structured content
- Web Content is not fetched with Headless Delivery API structured-contents