Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Bạn có thể kiểm soát số lượng tài nguyên tối đa mà máy chủ trả về trong phản hồi cho một yêu cầu liệt kê bằng cách đặt trường maxResults. Ngoài ra, đối với một số tập hợp (chẳng hạn như Sự kiện), có một giới hạn cố định về số lượng mục đã truy xuất mà máy chủ sẽ không bao giờ vượt quá. Nếu tổng số sự kiện vượt quá mức tối đa này, máy chủ sẽ trả về một trang kết quả.
Xin lưu ý rằng maxResults không đảm bảo số lượng kết quả trên một trang.
Bạn có thể phát hiện kết quả chưa hoàn chỉnh bằng trường nextPageToken không trống trong kết quả. Để truy xuất trang tiếp theo, hãy thực hiện chính xác yêu cầu như trước đây và thêm một trường pageToken có giá trị nextPageToken từ trang trước. Một nextPageToken mới sẽ xuất hiện trên các trang sau cho đến khi tất cả kết quả được truy xuất.
Ví dụ: sau đây là một truy vấn, theo sau là truy vấn để truy xuất trang kết quả tiếp theo trong danh sách phân trang:
GET /calendars/primary/events?maxResults=10&singleEvents=true
//Result contains
"nextPageToken":"CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA",
Truy vấn tiếp theo lấy giá trị từ nextPageToken và gửi giá trị đó làm giá trị cho pageToken:
GET /calendars/primary/events?maxResults=10&singleEvents=true&pageToken=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[],[],null,["# Page through lists of resources\n\nYou can control the maximum number of resources the server returns in the\nresponse to a list request by setting the `maxResults` field. Furthermore,\nfor some collections (such as Events) there is a hard limit on the number of\nretrieved entries that the server will never exceed. If the total number of\nevents exceeds this maximum, the server returns one page of results.\n\nRemember that `maxResults` does not guarantee the number of results on one page.\nIncomplete results can be detected by a non-empty `nextPageToken` field in\nthe result. In order to retrieve the next page, perform the exact same request\nas previously and append a `pageToken` field with the value of\n`nextPageToken` from the previous page. A new `nextPageToken` is provided\non the following pages until all the results are retrieved.\n\nFor example, here is a query followed by the query for retrieving the\nnext page of results in a paginated list: \n\n GET /calendars/primary/events?maxResults=10&singleEvents=true\n\n //Result contains\n\n \"nextPageToken\":\"CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA\",\n\nThe subsequent query takes the value from `nextPageToken` and\nsubmits it as the value for `pageToken`: \n\n GET /calendars/primary/events?maxResults=10&singleEvents=true&pageToken=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA"]]