Search and filter
On any collection endpoint, there is a certain set of filters enabled by default. Depending on the endpoint, there might be additional filters available, which will be specifically documented in these cases.
Filter collections
In all cases, ATTRIBUTENAME is a placeholder for the specific field name. Example: A not filter for a field named title would be described as ATTRIBUTENAME_not and would result in title_not. Multiple filters can be added to the same request.
Filters for all available fields
Name | Example | Notes |
equals | filter[ATTRIBUTENAME] | This filters for items with exact matching of the given value. |
not equals | filter[ATTRIBUTENAME_not] | This filters for items which to not match the given value. |
blank | filter[ATTRIBUTENAME_blank] | Filters for empty fields. |
Filters for text fields
Name | Example | Notes |
contains | filter[ATTRIBUTENAME_contains] | Search for parts of a string. |
fuzzy | filter[ATTRIBUTENAME_fuzzy] | This searches also for parts of a string, but adds some fuzzy logic for broader matching. |
Filters for integer and date fields
Name | Example | Notes |
less than | filter[ATTRIBUTENAME_lt] | Return any record less than the given value. |
less than or equal | filter[ATTRIBUTENAME_lte] | Return any record less than or equal to the given value. |
greater than | filter[ATTRIBUTENAME_gt] | Return any record greater than the given value. |
greater than or equal | filter[ATTRIBUTENAME_gte] | Return any record greater than or equal to the given value. |
range | filter[ATTRIBUTENAME_range] | Return any record between the given values. The format for the values is: FROM..TO where FROM and TO are the given values. |
Examples
Filter documents by status
Having a theoretical resource called document and we want to filter for all documents with status pending, the result would look like this:
GET /api/v1/documents?filter[status]=pending
Filter documents by status and a certain date range
Having a theoretical resource called document and we want to filter for all documents with status pending and a certain date range, the result would look like this:
GET /api/v1/documents?filter[status]=pending&filter[created_at_range]=2017-01-01..2017-02-01
Filter documents by status and query page 2
Having a theoretical resource called document and we want to filter for all documents with status pending and query page 2, the result would look like this:
GET /api/v1/documents?filter[status]=pending&page[number]=2
note: for the actual documents resource and its attributes, see document.