Overview

  • LSA utilizes pagination, enabling retrieval of large snapshots in multiple page fetches using maxresults and nextTokenParam.

  • Partners provide a nextTokenParam in the metadata.pagination object to construct subsequent page URLs, omitting it on the last page.

  • totalCount within metadata represents the total number of items across all pages, ensuring data consistency.

  • Partners are expected to provide a consistent number of service providers or review items that matches the initial totalCount.

Pagination

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.