Queries
Some endpoints in the HTTP API support querying using a custom JSON query format. Such a query is composed of criteria that must all match with support for sorting the result. Example of a query that can be used with the Content API:
{
"criteria": [
{
"type": "state",
"criteria": "completed"
},
{
"type": "completed"
"criteria": {
"from": "2018-02-17T04:19:03.636Z"
}
}
],
"sortBy": [ "completed" ]
}
Queries can include the following properties:
Name | Type | Description |
---|---|---|
criteria |
Array[Criteria] | Array of criteria, uses and between the criteria so all must match. Required |
sortBy |
Array[String] | Array of strings defining the properties to sort on and their order. |
Criteria
Each criteria consists of two properties type
and criteria
, where
criteria
depends on the type
.
Name | Type | Description |
---|---|---|
type |
String | The type of the criteria. |
criteria |
Dynamic | Dynamic value depending on the type. |
The exact types of criteria depend on the type of query used by the endpoint.
The criteria
property on the query object uses and matching meaning every
criteria used must match.
Sorting
The query format supports setting the sorting via the property sortBy
that
can contain an array of properties to sort on. The actual properties depend
on the exact type of query. Properties can be sorted in descending order by
appending :desc
or :descending
to them.
{
"criteria": ...,
"sortBy": [ "property:desc" ]
}