Filters
Apply one or multiple filters for list endpoints like All Documents and Document Collections. Each filter parameter refers to one field.
Filters can be submitted per URL with brackets or as URI Encoded JSON Object. Check out the examples page to see how it's done.
Filter documents
GET
https://api.cmft.io/v1/<repoName>/<endpoint>?filters[0][*.<fields|meta>.<fieldName>][operator]=<value>
Path Parameters
Name | Type | Description |
---|---|---|
repoName | string | The API identifier of the repository |
endpoint | string | The endpoint you'd like to request |
filter | string | Provide a filter with square brackets or as URI Encoded JSON Object |
Filter Types
Field Values
Parameter Name | Description |
| Filter which documents are returned in a query by checking the value with a relational operator. |
Notation
Apply a filter to multiple content types with a wildcard (*):
Or refer to a single document type using the following notation:
Basic Example
Or as JSON Object:
For more examples, have a look at the filters examples page.
Filters for nested fields
When applying filters for fields nested in sections, you'll have to omit the section property key.
The path for the filter would be *.fields.myField
, instead of *.fields.mySection.myField
Include Tags
Decide if a document is included in a list by checking its tags.
Parameter Name | Description |
| One of the tags must match for a document. |
Notation
Exclude Tags
If a document has one of the stated tags, it will not be included in a response.
Parameter Name | Description |
| Document will not be included if it has one of the stated tags. |
Notation
Relational Operators
Use Relational Operators to evaluate a fields value. Here is a reference for the available operators:
Notation | Convention | Explanation |
| equal | Validates true for a matching value |
| not equal | Validates true for non-matching values |
| greater than | Validates true if the field value is greater than the specified value |
| greater or equal to | Validates true if the field value is greater or equal to the specified value |
| less than | Validates true if the field value is lower than the specified value |
| less or equal to | Validates true if the field value is lower or equal to the specified value |
| like | Validates true if a field value matches. Possible usage: |
| not like | Validates true if a field value does not match. Possible usage: |
| empty | Validates true if the field value is empty |
| not empty | Validates true if the field value is not empty |
| in | Validates true if a value exists in an array |
| not in | Validates true if a value does not exists in an array |
Logical Operators
Use Logical Operators to connect filters. Available operators are:
AND
OR
Query String Notation
JSON Notation
Limitations
Filters are currently not available for relation fields. This feature is planned and we will update the documentation as soon as it lands.
Examples
Find some examples on the filters example page:
FiltersLast updated