Pagination
Pagination of Zoom APIs is the process of organizing the response results of an API call into multiple pages. When you’re making GET calls, especially bulk requests using the “list” API methods, there is a high possibility of a large number of records being returned. To make handling large payloads easier, we provide you with a way to control the maximum number of responses through pagination.
Next Page Token
For most of the existing Zoom APIs, such as List Meeting Participants API and List Webinars API, the next_page_token
parameter is used for pagination. If a response contains a non-empty string as the value for next_page_token
, it means that additional results are available for the query. This token can then be used in the subsequent requests to the API to get additional responses. If a complete response is sent in the initial query itself, the token will not be generated and the value of next_page_token
will be empty.
In the sample request below, the value of page_size
is set to 1 which means in our request to List Meetings (Dashboard) API we are stating that we only want one record to be displayed in the response.
var request = require("request");
var options = {
method: 'GET',
url: 'https://api.zoom.us/v2/metrics/meetings',
qs: {
page_size: '1',
to: '2019-08-07',
from: '2019-07-07',
type: 'past'
},
headers: {
authorization: 'Bearer abcd'
}
};
request(options, function(error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
In the response above, notice that a next_page_token
is returned. The total number of pages that exist for the request is 5
, hence, to view responses from other pages, use the next_page_token
as the query parameter in the subsequent requests.
We are in the process of deprecating the “page number” and “page count” fields. Please use “next_page_token” whenever possible for pagination. Learn more about this change here.
Pagination Using Page Numbers
For APIs such as the List Users API, you can see that there are two query parameters to help you with pagination:
page_size
: The number of records that you would like to get in the response per page.
page_number
: The specific page that you would like to view from all the pages containing response records.
Zoom APIs have a predetermined default and maximum values for page_size
and page_number
; however, we strongly recommend that you set the value for these parameters on your own based on your needs.
Once you make the request, you will be able to see how many pages there are for the request from the page_count
parameter included in the response.
The response will also include the page_number
field that shows which page you’re currently viewing the results from. For example, if in the response, the value of page_count
is 2
and the value of page_number
is 1
, you can paginate through the response and view results for the second page by making another request by setting the value of page_number
query parameter as 2
.
In the sample request below, the value of page_size
is set to 1
which means in our request to List Meetings API, we are stating that we only want one record to be displayed in the response.
var request = require("request");
var options = {
method: 'GET',
url: 'https://api.zoom.us/v2/users/someemailaddresshere@mail.com/meetings',
qs: {
page_number: '1',
page_size: '2',
type: 'scheduled'
},
headers: {
authorization: 'Bearer abcdef'
}
};
request(options, function(error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
In the response above, note that the total number of records for this query is 2
. However, only one record is displayed because we specified 1
as the value of the page_size
query parameter. To view the second record with page_size
as 1
, you will need to make another request similar to the one above, with page_number
set to 2
.
Need Support?
The first place to look for help is on our Developer Forum, where Zoom Marketplace Developers can ask questions for public answers.
If you can’t find the answer in the Developer Forum or your request requires sensitive information to be relayed, please email us at developersupport@zoom.us.