{% extends "rest_framework/api_basics.html" %} {% block description %}
Some API operations allow the results to be filtered according to flexible conditions. The basic syntax for filtering objects is:
<url>?<field name>=<oper>:<value>[&<field name>=<oper>:<value>]*
For example:
/api/rest/systems/1007/annotations/?description=like:important×tamp=between:[2016-12-01,2016-12-07]
The specific fields that can be used depend on the objects in question. Please refer to the documentation of each request for the list of valid fields.
These are the operators that can be used in filters:
| Operator | Acceptable value | Comments |
|---|---|---|
| eq | number/string/timestamp | This is the default operator if one is not specified. |
| ne | number/string/timestamp | |
| lt | number/string/timestamp | |
| le | number/string/timestamp | |
| gt | number/string/timestamp | |
| ge | number/string/timestamp | |
| in | list | Input list is val1, val2,.. which can be enclosed with () or [] or not enclosed at all. |
| out | list | Input list is val1, val2,.. which can be enclosed with () or [] or not enclosed at all. |
| between | list | A list of exactly two items, e.g. [5,10]; the filter is inclusive, equivalent to x >= 5 AND y <= 10. The between filter is symmetric, e.g. between[5,10] and between[10,5] mean the same thing. |
| like | string | Searches for a substring anywhere inside the text. |
Notes: