Filtering, sorting, pagination and including resources
Last updated
Last updated
Filtering, sorting and including resources adheres to the
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 with
suffix
- Ends with
gt
- Greater than
gte
- Greater than or equal to
lt
- Less than
lte
- Less than or equal to
match
- In a list of values
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
.
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:
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:
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: