浏览资源列表
您可以通过设置 maxResults
字段来控制服务器在响应列表请求时返回的资源数量上限。此外,对于某些集合(例如“事件”),服务器对检索到的条目数量设有硬性上限,且绝不会超出该上限。如果事件总数超过此上限,服务器会返回一页结果。
请注意,maxResults
并不能保证一页中的结果数量。您可以通过结果中的非空 nextPageToken
字段检测不完整的结果。如需检索下一页,请执行与上一步完全相同的请求,并附加一个 pageToken
字段,其中包含上一页中的 nextPageToken
值。在后续页面上,系统会提供新的 nextPageToken
,直到检索到所有结果。
例如,下面的第一个查询用于检索分页列表中的第一个页面,第二个查询用于检索下一页的结果:
GET /calendars/primary/events?maxResults=10&singleEvents=true
//Result contains
"nextPageToken":"CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA",
后续查询会从 nextPageToken
获取值,并将其作为 pageToken
的值提交:
GET /calendars/primary/events?maxResults=10&singleEvents=true&pageToken=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-21。
[null,null,["最后更新时间 (UTC):2024-12-21。"],[[["Control the maximum number of resources returned in a list request by setting the `maxResults` field, with some collections having hard limits on retrievable entries."],["Detect incomplete results by checking for a non-empty `nextPageToken` field, which indicates the presence of additional pages."],["Retrieve the next page of results by performing the same request and appending a `pageToken` field with the `nextPageToken` value from the previous page."],["The server provides new `nextPageToken` values on subsequent pages until all results are retrieved, enabling complete data retrieval through pagination."]]],[]]