Overview
Stay organized with collections
Save and categorize content based on your preferences.
LSA supports pagination to accommodate requests of a large snapshot in multiple
page fetches (pulls). Google will pull a given partner endpoint with a param
maxresults
to limit the maximum amount of serviceProviders returned in the
JSON response. Partners will populate a pagination token into the
metadata.pagination.nextTokenParam
field in the JSON response. The value of
this token is partner specific and is used to construct the next page URL. The
nextTokenParam
field must not be populated for the last page. Please note that
the metadata.pagination
object should always be populated (as it’s required in
the schema), even though the last page will not have a nextTokenParam
field.
Further, totalCount
indicates the total number of service providers (or
reviewItems
in the case of reviews feed) across all pages.
For example, if a partner has 200 providers in the full snapshot. When Google
initiates the feeds transfer with the url
http://www.partners.com/feeds/{version}/profile&maxresults=100
the first page
should return the first 100 partner providers with the following metaData
:
"metaData": {
"feedCategory":"SNAPSHOT",
"feedTimestampMicros":1532930955190163,
"apiVersion": "v1",
"pagination": {
"nextTokenParam": "yre7yiesar"
},
"totalCount":200
}
"serviceProviders": {....} // Contains 100 service provider objects.
Google will parse nextTokenParam: "yre7yiesar"
and will initiate the second
transfer with the url:
http:partners.com/feeds/{version}/profile&nextpagetoken=yre7yiesar&maxresults=100
The second page should return the last 100 providers. Given that the second
page is also the last page, nextTokenParam
will not be populated (metaData
example below), indicating the end of pagination.
"metaData": {
"feedCategory":"SNAPSHOT",
"feedTimestampMicros":1532930955190164,
"apiVersion": "v1",
"pagination": {},
"totalCount":200
}
"serviceProviders": {....}
Note that after fetching all pages, the total number of serviceProviders
objects (across all pages) must be equal to the totalCount
indicated on the
first page fetch.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-03 UTC."],[[["\u003cp\u003eLSA utilizes pagination, enabling retrieval of large snapshots in multiple page fetches using \u003ccode\u003emaxresults\u003c/code\u003e and \u003ccode\u003enextTokenParam\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003ePartners provide a \u003ccode\u003enextTokenParam\u003c/code\u003e in the \u003ccode\u003emetadata.pagination\u003c/code\u003e object to construct subsequent page URLs, omitting it on the last page.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003etotalCount\u003c/code\u003e within \u003ccode\u003emetadata\u003c/code\u003e represents the total number of items across all pages, ensuring data consistency.\u003c/p\u003e\n"],["\u003cp\u003ePartners are expected to provide a consistent number of service providers or review items that matches the initial \u003ccode\u003etotalCount\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Overview\n\nPagination\n----------\n\nLSA supports pagination to accommodate requests of a large snapshot in multiple\npage fetches (pulls). Google will pull a given partner endpoint with a param\n`maxresults` to limit the maximum amount of serviceProviders returned in the\nJSON response. Partners will populate a pagination token into the\n`metadata.pagination.nextTokenParam` field in the JSON response. The value of\nthis token is partner specific and is used to construct the next page URL. The\n`nextTokenParam` field must not be populated for the last page. Please note that\nthe `metadata.pagination` object should always be populated (as it's required in\nthe schema), even though the last page will not have a `nextTokenParam` field.\nFurther, `totalCount` indicates the total number of service providers (or\n`reviewItems` in the case of reviews feed) across all pages.\n\nFor example, if a partner has 200 providers in the full snapshot. When Google\ninitiates the feeds transfer with the url\n`http://www.partners.com/feeds/{version}/profile&maxresults=100` the first page\nshould return the first 100 partner providers with the following `metaData`: \n\n \"metaData\": {\n \"feedCategory\":\"SNAPSHOT\",\n \"feedTimestampMicros\":1532930955190163,\n \"apiVersion\": \"v1\",\n \"pagination\": {\n \"nextTokenParam\": \"yre7yiesar\"\n },\n \"totalCount\":200\n }\n \"serviceProviders\": {....} // Contains 100 service provider objects.\n\nGoogle will parse `nextTokenParam: \"yre7yiesar\"` and will initiate the second\ntransfer with the url:\n`http:partners.com/feeds/{version}/profile&nextpagetoken=yre7yiesar&maxresults=100`\n\nThe second page should return the last 100 providers. Given that the second\npage is also the last page, `nextTokenParam` will not be populated (`metaData`\nexample below), indicating the end of pagination. \n\n \"metaData\": {\n \"feedCategory\":\"SNAPSHOT\",\n \"feedTimestampMicros\":1532930955190164,\n \"apiVersion\": \"v1\",\n \"pagination\": {},\n \"totalCount\":200\n }\n \"serviceProviders\": {....}\n\nNote that after fetching all pages, the total number of `serviceProviders`\nobjects (across all pages) must be equal to the `totalCount` indicated on the\nfirst page fetch."]]