Filter items
Get the collection for filtering
You retrieve a collection of items by using the methods:
Filter expressions
The above methods accept an expression parameter that is automatically converted to a REST call.
These expressions are the following:
You can combine all of the above expressions in any binary operator form (&& ||).
Complex filtering
For more complex filters, an alternative method is provided on the IRestClient
interface:
The GetAllArgs
argument allows you to provide additional parameters for projection, filtering, sorting, pagination, and total count in the following way:
Use it in the following way:
This filter expression is a hierarchical object structure of the types FilterClause
and CombinedFilter
.
FilterClause
The operators available for the basic filter (FilterClause
) are the following:
Logical operators
- Equals -
"eq"
- Does not equal -
"ne"
- Greater than (for numbers) -
"gt"
- Less than (for numbers) -
"lt"
- Greater than or equal (for numbers) -
"ge"
- Less than or equal (for numbers) -
"le"
- Contains any of the collection -
"any+or"
- Contains all of the collection -
"any+and"
- Does not contain any of the collection -
"not+(any+or)"
Specific string operators
- Starts with -
"startswith"
- Ends with -
"endswith"
- Contains -
"contains"
Example
In this example:
FieldName
maps to the name of the custom field for the selected content type.
Operator
maps to the logical operator
FieldValue
maps to the value with which to execute the logical operation.
CombinedFilter
The combined filter is recursive and can contain child combined filters. The combined filter has an additional property called Operator
which can have the value of And
or Or
which correspond to Logical AND and logical OR between the child filters.
Mixed filter
The two filtering strategies can be mixed using the following method. It simplifies the usage of the filters and provides a parameter to control the pagination, ordering, total count and projection:
Filtering examples
Filter by translated tags
Filter by parent items with SDK object