Queries
To effectively manage your content throughout the localization or content creation process, the HTTP API provides a feature to query existing requests. These queries consist of one or more criteria, all of which must align for a successful match. Additionally, the API supports sorting the results to facilitate better organization.
Below is an illustrative example of how to retrieve all requests that have been completed since October 1, 2023, and beyond, sorted based on their completion dates using the Content API endpoint.
{
"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 specific criteria types available depend on the type of query employed by the endpoint.
The criteria
property on the query object operates with a matching principle, signifying that every criterion 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" ]
}