The JourneyApps API (V1) → 7. Queries/Filtering & Searching
Queries (Filtering Retrieved Objects)
This function allows you to retrieve a list of objects matching specified criteria.
Relative URL | HTTP Request Method |
---|---|
/api/v1/object-type.format?query[attribute]=value | GET |
/api/v1/object-type.format?q[attribute]=value | GET |
/api/v1/object-type.format?query[attribute]=value1&query[other_attribute]=value2 | GET |
json
or xml
), or leave it out. Multiple query criteria can be specified.
Parameters
Query parameters are specified as a URL-encoded query
or q
hash. Valid keys for this hash are names of the attributes in that object-type. The format for the values are the same as for creating objects. Please refer to the same section at Creating New Objects.
You can specify your criteria with logic such as 'equals', 'not equal to', 'greater than', 'less than', etc. as follows:
Comparison | Syntax | Allowed Values |
---|---|---|
Attribute Equals | query[attribute]=value | |
Attribute is Not Equal To | query[attribute.ne]=value | |
Attribute is Less Than | query[attribute.lt]=value | |
Attribute is Less Than or Equal To | query[attribute.lte]=value | |
Attribute is Greater Than | query[attribute.gt]=value | |
Attribute is Greater Than or Equal To | query[attribute.gte]=value | |
Attribute Contains | query[attribute.contains]=value | |
Attribute is Null (or Not Null) | query[attribute.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 Retrieving All Objects section.)
Examples
\[
) or add the -g
option to turn off curl's globbing functionality
Searching Across All Attributes
You can also search through all the attributes of all objects of a given type for a partial text match. This can be useful for implementing basic search functions.
Relative URL | HTTP Request Method |
---|---|
/api/v1/object-type/search.format | POST |
Parameters
The search text must be specified as a URL-encoded parameter named query
.
Example
Search task
objects for the text "First":
Response: