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
Replace
model
with the type of object that you wish to retrieve (as defined in your app's Data Model), for exampleperson
,job
orasset
.Multiple query criteria can be specified.
Certain "hidden" fields are prefixed with an underscore, for example: to query on the
updated_at
hidden field, use_updated_at
.
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"
The contains
operator is case-sensitive.
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
BASE-URL
The below examples contain a BASE-URL
placeholder. Please refer to the HTTP Endpoints section to get the base URL relevant to your deployment.
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
BASE-URL
The below examples contain a BASE-URL
placeholder. Please refer to the HTTP Endpoints section to get the base URL relevant to your deployment.
Search task
objects for the text "site":
task
objects for the text "site":Response:
Last updated