Filtering parameters
modular_content object property. Check out examples of filtering content items.If you need to retrieve just a subset of elements, specify the elements you want using the elements filter. For example, elements=summary.
If you want to exclude a subset of elements while retrieving content items, you can specify those elements using the excludeElements filter. For example, items?excludeElements=location.
Filter by system values
To filter by system property values, use a query parameter in thesystem.<property_name> format. The system properties are id, collection, name, codename, language, type, last_modified, workflow, and workflow_step. For example, to retrieve only content items based on the Article content type, use system.type=article as the query parameter.
Filter by element values
To filter by content element values, you need to use a query parameter in theelements.<element_codename>=<value> format. For example, to retrieve only content items whose number element named Price has a value of 16, use elements.price=16 as a query parameter.
Join multiple query parameters
You can join multiple query parameters using the& character. Queries with two or more filtering parameters are more restrictive because the individual query parameters are merged with a logical conjunction (AND).
For example:
- The query
system.type=article&elements.category[contains]=naturereturns the Article content items tagged with the term Nature. - The query
elements.subpages[contains]=my_pagereturns the content items that link to themy_pagecontent item in their subpages element. This means you get a list of items where themy_pageitem is used in. - The query
system.type=page&excludeElements=titlewill return Page content items without the element Title.
Filtering operators
You can use the following filtering operators with both the system properties and element values.| Operator | Description | Example | Use with |
[eq] (same as =) | Property value equals the specified value. | system.type=article
system.type[eq]=article
| Simple types |
[neq] | Property value does not equal the specified value. | system.type[neq]=article
system.workflow_step[neq]=archived
| Simple types |
[empty] | Property value is empty. | elements.title[empty]
elements.author[empty]
For rich text, use the equals operator, elements.content[eq]=<p><br></p>.
| Simple types and arrays |
[nempty] | Property value is not empty. | elements.title[nempty] | Simple types and arrays
|
[lt] | Property value is less than the specified value. See Comparing values. | system.last_modified[lt]=2019-03-01
elements.price[lt]=10
| Simple types |
[lte] | Property value is less than or equal to the specified value. See Comparing values. | system.last_modified[lt]=2019-02-01
elements.price[lte]=4
| Simple types |
[gt] | Property value is greater than the specified value. See Comparing values. | system.last_modified[gt]=2019-01-01
elements.price[gt]=10
| Simple types |
[gte] | Property value is greater than or equal to the specified value. See Comparing values. | system.last_modified[gte]=2019-02-28
elements.price[gt]=10
| Simple types |
[range] | Property value falls within the specified range of two values, both inclusive. See Comparing values. | system.last_modified[range]=2018-02-01,2018-03-31
elements.price[range]=10.5,50
| Simple types |
[in] | Property value is in the specified list of values. | system.type[in]=cafe,coffee
elements.price[in]=8.5,9,10.5
| Simple types |
[nin] | Property value is not in the specified list of values. | system.type[nin]=home,page | Simple types |
[contains] | Property with an array of values contains the specified value. The [contains] operator cannot be used on strings. | elements.category[contains]=nature
elements.subpages[contains]=my_page
| Arrays |
[any] | Property with an array of values contains at least one value from the specified list of values. | elements.category[any]=technology,nature | Arrays |
[all] | Property with an array of values contains all of the specified values. | elements.category[all]=technology,mobile | Arrays |
Arrays vs. simple types
You can use the[contains], [any], and [all] filtering operators only on arrays. The content elements that support these operators are custom elements (see limitations below), linked items, multiple choice, and taxonomy.
For custom elements, the [contains], [any], and [all] filters work only if the element's value is a stringified array of strings such as "[\"DE\",\"US\",\"UK\"]". The [contains], [any], and [all] operators can NOT be used on asset elements.
Comparing values
The[lt], [lte], [gt], [gte], and [range] filtering operators work best with numbers. For example, you can retrieve products with price larger or equal to 15 by using elements.price[gte]=15.