Pagination
Pagination is exclusive to the GetConversation
endpoints
/api/Chat/GetConversations/{agentid}/{results}/{skip}/{metadatasearch}
/api/Chat/GetConversations/{agentid}
/api/Chat/GetConversations
The Semantic Meaning of the pagination-related parameters are:
results
: Page Lengthskip
: Starting IndexCorresponds with (
page_num
*page_size
)
🔢 How to Fetch a Specific Page of Data
Fetching page-based data is simple when you understand how to calculate what to fetch and from where to start.
📘 What You Need to Know
To request Page N from our API, you’ll need to provide two key numbers:
results
How many items you want (page size)
20
skip
Where to start from in the total list
(3 - 1) * 20 = 40
🔍 Formula:
skip = (pageNumber - 1) * results
This formula tells the API where in your data to begin. The results
value tells it how many items to return from that point.
🧭 Understanding API Parameters (with Purpose)
agentid
string
No*
The ID of the agent you want data for. Omit if you want system-wide data.
results
integer
Yes
Number of records per page. Defaults to 20 if not specified.
skip
integer
Yes
Offset in the dataset (calculated based on current page).
metadatasearch
string
No
Optional keyword filter. Use ""
(empty string) if not filtering.
Below are plug-and-play functions that dynamically support both API routes:
/api/Chat/GetConversations/
(when agent ID is not known)/api/Chat/GetConversations/{agentid}
(when it is)
These helpers calculate the correct skip
, and let your app specify the page without worrying about the URL details.
✅ If agentid
is omitted, just use /api/Chat/GetConversations
— the API will still respond with paginated data.
Note: For your own app integrating with our API, it is typical in pagination to first get the total number of query-able items in the not-paginated data source so that you know for instance what the max.
🛠 Pagination Helper (Agent Handling)
🧑💼 Example: Fetching Page 4 with Filter
Scenario: You want to load Page 4 of a conversation list filtered by the keyword “sales”
, with 25 results per page.
Using the API directly:
page = 4
results = 25
skip = (4 - 1) * 25 = 75
With the helper:
🔁 Recap: Building a UI with Pagination
To integrate pagination smoothly into your UI:
Set a default
results
value (e.g., 20 or 50)Track
currentPage
in your frontend or backend stateWhen the user clicks “Next” or “Previous”:
Update
page
Recalculate
skip
Re-fetch data using the helpers above
Render the results into your UI
💡 Pro tip: You can pre-fetch the next page in the background to create an “instant” pagination experience.
Last updated