Sometimes it's useful to search for a specific String in multiple attributes.
Given that URL query parameters do not allow OR conditions, we took the extra step and provide you with an easy query parameter that allows you to search the following fields at the same time:
label
name
description
username
firstName
lastName
In order to search for a specific string on all fields just add the query parameter search=string
.
GET https://industrial.api.ubidots.com/api/v2.0/variables/?search=demo
//Returns Array 'results' containing all variables that have the string 'demo' in either of the 6 fields
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"label": "demo",
"name": "Demo",
"description": "",
...
}
]
}
Feature
The
search
parameter is even more powerful. You can append the following parameters to enhance your search capabilities:
iexact
(Case Insensitive)contains
icontains
(Case Insensitive)startswith
istartswith
(Case Insensitive)endswith
iendswith
(Case Insensitive)For more information about these parameters, please refer to the Text section.