Filter methods
Use Ubidots field filters.
The Ubidots API supports requests using field filters, like this:
This library also provides a way to construct custom requests that take advantage of these filters.
Filter methods
where
Applies a filter on a single property of the given entity
Ubidots.<entity>.where(<entity-property>).<filter>(<filter-value>).<get-method>(, [args])
A valid property of the given entity
addRawParams
Applies filters on multiple properties of the given entity
Ubidots.<entity>.addRawParams(<query-object>).<get-method>(, [args])
query-object: object
An object containing queryparam-value pairs
Using where
method
where
methodThe example GET request shown at the top of this page can be replicated using the library's where
method, like this:
Here:
<entity> = devices
<entity-property> = 'label'
<filter> = startsWith
<filter-value> = 'temp'
<getMethod> = get
Using addRawParams
method
addRawParams
methodThe example GET request shown at the top of this page can be replicated using the library's addRawParams
method, like this:
Here:
<entity> = devices
<queryObject> = filterParameters
<getMethod> = get
<queryParam1> = label__startswith
<value1> = 'temp'
Accessing the filters
API filters are written in snake-case. Take a look at some of the supported object filters for example:
contains
contained_by
has_key
In order to maintain the camel-case standard of JavaScript, the library's filters are written in camel-case, so the previous filters would look like this:
contains
containedBy
hasKey
Below you'll find the full list filters, as defined in the API vs. how they look in the library.
exact ( = )
exact
in
in
exact ( = )
is
isnull
isNull
exact
is
range
range
gt ( > )
greaterThan
gte (≥
)
greaterThanEq
lt ( < )
lowerThan
lte (≤
)
lowerThanEq
isnull
isNull
exact ( = ) (case sensitive)
exact
iexact (case sensitive)
iexact
contains
contains
icontains (case insensitive)
iContains
startswith
startsWith
istartswith (case insensitive)
iStartsWith
endswith
endsWith
iendswith (case insensitive)
iEndsWith
in (case sensitive)
in
isnull
isNull
exact ( = )
exact
contains
contains
contained_by
containedBy
overlap
overlap
len
len
isnull
isNull
contains
contains
contained_by
containedBy
has_key
hasKey
has_any_keys
hasAnyKeys
has_keys
hasKeys
isnull
isNull
exact ( = )
exact
date
date
year
year
quarter
quarter
month
month
week
week
day
day
hour
hour
minute
minute
second
second
isnull
isNull
Last updated