Starting from version 0.49, specific Rocket.Chat API endpoints support the following query parameters:
Pagination
Pagination
Pagination parameters allow you to control the number of results returned by an API request. The available parameters are listed below:
Parameter | Example | Description | Format |
|---|---|---|---|
|
| The number of items to "skip" in the query. For example, a request returns | Positive integer |
|
| The number of items to return. | Integer |
|
| Defines the fields and direction for sorting results. Use | JSON object (key-value pairs for field and order) |
Pagination parameter settings
To modify the behavior of the offset and count parameters, go to Manage → Workspace → Settings → General → REST API.
The following configuration options are available:
Default Count: The default number of results returned by REST API endpoints when the
countparameter is not specified.Max Record Amount: The maximum limit for the
countparameter. If a higher value is provided, this limit will apply instead.Allow Getting Everything: Enables the API to return all records when the
countparameter is set to0.
These settings give you fine-grained control over how data is paginated, sorted, and returned from Rocket.Chat API responses.
Example call
To retrieve a specific page of results with five items per page, use the
count=5andoffset=10query parameters in your API request:
GET http://localhost:3000/api/v1/channels.list?count=5&offset=10To sort results by
namein descending order andstatusin ascending order, use thesortparameter with a JSON object specifying field directions:
GET http://localhost:3000/api/v1/users.list?sort={"name":-1,"status":1}