Pagination and filtering
List operations return one page of results at a time. Most take their paging and search options as query parameters; the ticket list and the chat list take them, together with their filters, in a JSON body.
How it works
Section titled “How it works”The page you get back
Section titled “The page you get back”Every paged list answers with the same envelope:
| Field | Meaning |
|---|---|
data |
The items on this page. |
currentPage |
The page number of this page, from 1. |
pageSize |
The page size used. |
totalRecords |
How many items match, across all pages. |
pagesCount |
How many pages there are at this page size. |
Read pages from 1 up to pagesCount, then stop. Do not page until you get an empty data.
Lists with query parameters
Section titled “Lists with query parameters”Operations such as GET /openapi/template/paged, GET /openapi/customer/paged and GET /openapi/order/paged take:
| Parameter | What it does | Default | Limits |
|---|---|---|---|
page |
The page to return. | 1 | from 1 |
count |
Items per page. | 10 | 1 to 100; more than 100 is refused with 400 |
term |
Search text, matched without regard to case against the resource’s searchable fields. | none: every item | — |
sort |
The field to order by, spelled as the property appears in the response, for example createdDate. |
the item’s id | a field name the API does not allow is refused with 400 |
asc |
true for ascending, false for descending. |
true |
— |
The message lists, GET /openapi/message/pagedthreadmessages/{threadId} and
GET /openapi/chat/pagedchatmessages/{chatId}, also take page and count, with the same default of 10 items per
page; ask for at most 100. The ticket’s message list takes only page, count and asc, and returns the newest
messages first unless you send asc=true.
Lists with a filter body
Section titled “Lists with a filter body”POST /openapi/thread/ticketsforreading/paged (tickets) and POST /openapi/chat/paged (live chats) take the paging
options in the body, next to their filters:
| Field | What it does | Default |
|---|---|---|
page |
The page to return. | 1 |
count |
Items per page, at most 100; more is refused with 400. | 10 |
term |
Search text. | none |
sort |
The field to order by. | tickets: the last message’s date |
asc |
true for ascending. |
false: newest first |
The ticket list narrows on the server with fields such as folderId, accounts, users, customerId, startDate
and endDate. The API reference lists every filter field.
An example
Section titled “An example”Ask for the second page of 50 templates:
curl "https://open-api.replyco.com/openapi/template/paged?page=2&count=50" \ -H "Authorization: Bearer $ACCESS_TOKEN"{ "totalRecords": 61, "pageSize": 50, "pagesCount": 2, "currentPage": 2, "data": [ { "id": "6b0e3c1d-2f4a-4b8e-9d1c-7a5e3f2b1c09", "name": "Delivery delay", "text": "Sorry for the wait. Your parcel is on its way and should arrive within two working days.", "inActive": false } ]}Ask for the 100 tickets assigned to one agent, those with the most recent message first:
curl -X POST https://open-api.replyco.com/openapi/thread/ticketsforreading/paged \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -d '{"page": 1, "count": 100, "users": ["c4e8a1b2-5d6f-4a7b-8c9d-0e1f2a3b4c5d"]}'{ "page": 1, "count": 100, "users": ["c4e8a1b2-5d6f-4a7b-8c9d-0e1f2a3b4c5d"] }Each operation whose path ends in /paged allows one user 15 calls a minute. Ask for
large pages and filter on the server instead of reading every page of an unfiltered list. See
Rate limits.
Related
Section titled “Related”- Answer tickets from your own system: the ticket list in a full task.
- Rate limits: how often you may call list operations.
- API reference: every list operation’s parameters and filter fields.