リソースの一覧を順番に確認する
maxResults
フィールドを設定することで、リスト リクエストへのレスポンスでサーバーが返すリソースの最大数を制御できます。さらに、一部のコレクション(イベントなど)では、取得するエントリの数にハードリミットがあり、サーバーがその上限を超えることはありません。イベントの合計数がこの上限を超えると、サーバーから 1 ページの結果が返されます。
maxResults
では、1 ページに表示される結果の数は保証されません。結果が不完全な場合は、結果の nextPageToken
フィールドが空でないことを確認します。次のページを取得するには、前回とまったく同じリクエストを実行し、前のページの nextPageToken
の値を持つ pageToken
フィールドを追加します。すべての結果が取得されるまで、次のページに新しい 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 Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-12-21 UTC。
[null,null,["最終更新日 2024-12-21 UTC。"],[[["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."]]],[]]