This section explains the filter query parameters.
The Ubidots API v2.0 offers a powerful way to customize the GET requests with filters. Filters can be applied on many of the objects attributes. Given the different attribute types there are different types of filters that can be applied.
Filter syntax
For all filters except for the exact match, the format is as follows:
<attribute>__<filtertype>=<filter-value>
Example
id__in=bae24901a92daa61ddc90626,4e1cb1e6d8b69d53afec
tags__contains=usa,san%20diego
lastTriggered__gt=1583248038207
Negating filters
All filters can also be negated by appending !=
instead of =
in the query string. This is useful when you want to exclude results that match a certain condition.
Example
Filter Type | Normal Filter | Result Description | Negated Filter | Result Description (Negated) |
---|---|---|---|---|
Greater Than | lastTriggered__gt=1583248038206 | Returns events triggered after this timestamp. | lastTriggered__gt!=1583248038206 | Returns events not triggered after this timestamp. |
Contains | tags__contains=temperature | Returns elements where tags includes "temperature". | tags__contains!=temperature | Returns elements where tags does not include it. |
This pattern works across all filter types (gt, lt, in, contains, isnull, etc.).