Filtering, sorting, pagination and including resources
Filtering, sorting and including resources adheres to the JSON:API specification
Filtering
You can filter the result set by adding the filter
query parameter to the URL.
For example, to filter flow runs by status, you could use: GET /flow-runs?filter[status]=finished
To filter flow runs by status and messageThreadId, you could use: GET /flow-runs?filter[status]=finished&filter[messageThreadId]=7135853f-26ac-4a65-9044-cab092806249
Note that the API will return all resources that match all provided filter criteria.
Filtering supports not only exact match but also other operators:
Available operators are:
eq
- Equal to (case-sensitive)eql
- Equal to (case-insensitive)prefix
- Starts withsuffix
- Ends withgt
- Greater thangte
- Greater than or equal tolt
- Less thanlte
- Less than or equal tomatch
- In a list of values
Examples
To filter records which field value is in a list of values. Use GET /messages?filter[delivery_status]=sent,accepted
. Or GET /messages?filter[delivery_status][match]=sent,accepted
.
To filter records which created_at
field value is greater than specified date, use GET /messages?filter[created_at][gt]=2022-02-05
.
Sorting
Use the sort
query parameter to specify your desired order of results.
For example to order messages by when they were created, you might want to use:
GET /messages?sort=createdAt
For example to order messages by when they were created in descending order, you could use:
GET /messages?sort=-createdAt
Pagination
Use the page
query parameter to specify the desired page size
and number
. By default the page size is set to 25 and you will always receive the first page. The maximum page size is locked at 200 rows.
For example to replicate the default pagination you would use:
GET /messages?&page[size]=25&page[number]=1
Including
In some cases, you may want to include associated resources in your results. Let's say you have a relationship between messages and threads, and you want to include related threads within each returned message. You can use:
GET /messages?include=messageThreads
Last updated