Search code examples
google-apis-explorergoogle-photos-api

Google Photos API, pageSize Parameter not returning expected results


Using the Google Photos API Explorer I am trying to limit the number of albums returned using the albums.list method.

If I set pageSize = 10, the api explorer returns 5 albums, if I set it to 3 in returns 1 album.

Any suggestions as to why I am not seeing the same number of albums in the response as is set via the pageSize parameter?

Thanks


Solution

  • The page size describes the desired maximum number of results, but it is no guarantee.

    If you need at least 10 results from a single request, your best option would be to request a higher page size as you have found. Alternatively, you can always make additional requests using the nextPageToken.

    (We have some plans to improve this in the future and return a number of results that's equal, or even closer, to the page size. Unfortunately, at the moment we can't guarantee the number of results in a request, but we always try to fill a page size if possible.)