קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אתם יכולים לקבוע את המספר המקסימלי של מקורות שהשרת מחזיר בתגובה לבקשת רשימה על ידי הגדרת השדה maxResults. בנוסף, עבור אוספים מסוימים (כמו Events) יש מגבלה קשיחה על מספר הרשומות שאוחזרו, שהשרת לעולם לא יחרוג ממנה. אם המספר הכולל של האירועים חורג מהמקסימום הזה, השרת מחזיר דף אחד של תוצאות.
חשוב לזכור שהגדרת 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
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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"]]