Query Objects
Queries
This function allows you to retrieve a list of objects matching specified criteria.
/api/v4/
backend-deployment-id
/objects/
model
.json?query[
field
]=
value
GET
/api/v4/
backend-deployment-id
/objects/
model
.json?q[
field
]=
value
GET
/api/v4/
backend-deployment-id
/objects/
model
.json?query[
field
]=
value1
&query[
other_field
]=
value2
GET
Parameters
Query parameters are specified as a URL-encoded query
or q
hash. Valid keys for this hash are the names of the fields in that model. The format for the values is the same as for creating objects. Please refer to the same section at Creating a New Object.
You can specify your criteria with logic such as 'equals', 'not equal to', 'greater than', 'less than', etc. as follows:
Equals
query[
field
]=
value
is Not Equal To
query[
field
.ne]=
value
is Less Than
query[
field
.lt]=
value
is Less Than or Equal To
query[
field
.lte]=
value
is Greater Than
query[
field
.gt]=
value
is Greater Than or Equal To
query[
field
.gte]=
value
Contains
query[
field
.contains]=
value
is Null (or Not Null)
query[
field
.null]=
value
Specify true
for the value to check for "Is Null" or false
to check for "Is Not Null"
Response
The response includes a list of all the objects of the given type which match all of the query criteria. The format of the objects is the same as for listing all objects (please refer to the Retrieve All Objects section.)
Examples
When using curl with queries you have to either escape the square brackets with a backslash \
or add the -g
option to turn off curl's globbing functionality.
Match a text field:
Match multiple fields, including human-readable dates:
Query with datetime
in ISO8601 format:
datetime
in ISO8601 format:Match a value (as a string) from a single-choice field:
Query on a relationship - Find all assets related to the specified room:
Searching Across All Fields
You can also search through all the fields of all objects of a given type for a partial text match. This can be useful for implementing basic search functions.
/api/v4/
backend-deployment-id
/objects/
model
/search.json
POST
Parameters
The search text must be specified as a URL-encoded parameter named query
.
Example
Search task
objects for the text "site":
task
objects for the text "site":Response:
Last updated