0

I'm trying to get all media items in my Google Photos library and referred following documentation link. https://developers.google.com/photos/library/guides/list

Documentation says client can request pages using pageSize and provided following example.

GET https://photoslibrary.googleapis.com/v1/mediaItems
Content-type: application/json
Authorization: Bearer OAUTH2_TOKEN
{
  "pageSize":"100",
}

i think the comma after 100 is a documentation error and i removed it from request, but whenever i add pageSize (or pageToken) parameter, server always return with 400 Bad Request <p>Your client has issued a malformed or illegal request.<ins>That’s all we know.</ins>

Here are some example REST API calls i tried

GET /v1/mediaItems HTTP/1.1
Host: photoslibrary.googleapis.com
Content-Type: application/json
Authorization: Bearer xxx

{
  "pageSize":10
}


GET /v1/mediaItems HTTP/1.1
Host: photoslibrary.googleapis.com
Content-Type: application/json
Authorization: Bearer xxx

{
  "pageSize":"10"
}



GET /v1/mediaItems HTTP/1.1
Host: photoslibrary.googleapis.com
Content-Type: application/json
Authorization: Bearer xxx

{ 
   "pageToken":"blha blha"
}


Please note that whenever i removed the json from request body, it start returning 200 OK with predefined pageSize. but i would like to control the pageSize and request next pages using pageToken.

Thanks for any guidance on this matter.

Cipson
  • 1

1 Answers1

2

I just started looking at this too. Those parameters shouldn't be passed in the body. They are query parameters. So something like this:

https://photoslibrary.googleapis.com/v1/mediaItems?pageSize=100

That worked for me at least. Check out further documentation at https://developers.google.com/photos/library/reference/rest/v1/mediaItems/list to review information about the query parameters.

Mike G
  • 51
  • 1
  • 7