A typical boolean attribute is isActive
. Even though many boolean attributes, even if not provided in the body, have a default value, some do not and get assigned null
.
Field Type: Boolean
Filters Available: exact (=
), isnull
exact
Filters for an exact match of true
or false
.
GET https://industrial.api.ubidots.com/api/v2.0/events/?isActive=true
// Returns Array 'results' with all active Events
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "5e5e72491d8472617925a541",
"isActive": true,
...
},
{
"id": "5e5428711d8472602d91dbcf",
"isActive": true,
...
}
]
}
isnull
In case you have an object whose boolean attribute is null
you can use the <attribute>__isnull
filter to obtain all items with that property in null
.
Truthy and Falsy
True
,true
and1
can all be used to tell the backend that a boolean istrue
. The same applies toFalse
,false
, and0
.