Skip to main content
Version: Next

Search_Endpoint

Search Endpoint

The search endpoint allows you to query headless documents via a REST endpoint. Each request to the endpoint needs to include the API key in the header.

Request Parameters

The search endpoint supports the following request parameters in the URL:

  • filter: Filter the documents by specific values
  • size: Limit the number of documents returned
  • order_by: Order the documents by specific values
  • sort_order: Sort the documents in ascending or descending order by passing asc or desc

Filter syntax

Filter syntax is based on a limited and simplified subset of the syntax described in here.

Note: A filter for "type": "headlessdocument" is always applied.

Supported Logic Operators

  • $not
  • $or
  • $and

Examples

q={"modificationDate" : "1000"}

... SQL equivalent ...
where ((`modificationDate` = '1000') )
q=[{"creationDate" : "1000"}, {"modificationDate" : "9999"}]
...
where ( ((`creationDate` = '1000') ) AND ((`modificationDate` = '9999') ) )
q={"modificationDate" : "1000"}, "$or": [{"id": "3"}, {"key": "lorem-ipsum"}]}
...
where ((`o_modificationDate` = '1000') AND ((`id` = '3') OR (`key` = 'lorem-ipsum') ) )
q={"$and" : [{"published": "0"}, {"modificationDate" : "1000", "$or": [{"id": "3"}, {"key": "lorem-ipsum"}]}]}
...
where ( ((`published` = '0') ) AND ((`modificationDate` = '1000') AND ((`id` = '3') OR (`key` = 'lorem-ipsum') ) ) )

Example

Request

Example request for a configuration with name FooConfig:

http://localhost/pimcore-datahub-webservices/headlessdocuments/FooConfig/search?order_by=id&sort_order=DESC&filter={%22key%22:%20{%22$like%22%20:%22%SimpleHeadless%%22}}

This request will return all documents that contain the value SimpleHeadless in the key and order it descending by id.

Response

The response will be a JSON object containing the documents that match the search criteria.

{
"headlessDocuments": {
"228": {
"parentId": 1,
"type": "headlessdocument",
"path": "/",
"headlessDocumentsTemplate": "Grid",
"key": "HeadlessDoc_Grid",
"published": true,
"modificationDate": 1732012770,
"creationDate": 1730985959,
"userOwner": 20,
"userModification": 20,
"editables": {
"headline": {
"value": "Headline test 1234234234",
"type": "input"
},
"text": {
"value": "<p>Text here</p>",
"type": "wysiwyg"
},
"content": {
"type": "areablock",
"bricks": [
{
"type": "text",
"editables": {
"headline": {
"value": "Subheadline Value",
"type": "input"
},
"description": {
"value": "<p>Description value</p>",
"type": "wysiwyg"
}
}
},
{
"type": "editableTypes",
"editables": {
"durations": {
"value": [
"one-month",
"three-months"
],
"type": "multiselect"
},
"more_info_mto": {
"value": {
"id": 16,
"type": "object",
"subtype": "object"
},
"type": "relation"
},
"more_info_mtm": {
"value": [
{
"id": 10,
"type": "asset",
"subType": "image"
},
{
"id": 11,
"type": "asset",
"subType": "image"
},
{
"id": 13,
"type": "object",
"subType": "object"
},
{
"id": 16,
"type": "object",
"subType": "object"
},
{
"id": 20,
"type": "object",
"subType": "object"
}
],
"type": "relations"
},
"prices": {
"value": [
[
"Product",
"From",
"To"
],
[
"Jaguar",
"20000",
"30000"
],
[
"Porsche",
"10000",
"40000"
]
],
"type": "table"
}
}
}
]
},
"images": {
"type": "block",
"image": {
"items": [
{
"value": {
"id": 67,
"alt": "",
"cropPercent": false,
"cropWidth": 0,
"cropHeight": 0,
"cropTop": 0,
"cropLeft": 0,
"hotspots": [],
"marker": [],
"thumbnail": "galleryThumbnail"
},
"type": "image"
},
{
"value": {
"id": 69,
"alt": "",
"cropPercent": false,
"cropWidth": 0,
"cropHeight": 0,
"cropTop": 0,
"cropLeft": 0,
"hotspots": [],
"marker": [],
"thumbnail": "galleryThumbnail"
},
"type": "image"
},
{
"value": {
"id": 205,
"alt": "",
"cropPercent": false,
"cropWidth": 0,
"cropHeight": 0,
"cropTop": 0,
"cropLeft": 0,
"hotspots": [],
"marker": [],
"thumbnail": "galleryThumbnail"
},
"type": "image"
}
]
}
}
},
"properties": {
"footer": {
"value": {},
"type": "document"
},
"language": {
"value": "en",
"type": "text"
},
"left_nav_show": {
"value": false,
"type": "bool"
},
"left_nav_start_node": {
"value": {},
"type": "document"
},
"navigation_root": {
"value": {},
"type": "document"
},
"newsletter_confirm_mail": {
"value": {},
"type": "document"
},
"news_default_document": {
"value": {},
"type": "document"
},
"password_reset_mail": {
"value": {},
"type": "document"
},
"terms_and_conditions": {
"value": {},
"type": "document"
}
}
}
}
}