photos.google.com/activities/photo_likes - call in javascript

902 Views Asked by At

https://photos.google.com/activities/photos_likes returns likes photos in shared albums. I would like to use the photoslibrary api or the activities api to find liked photos in shared albums.

However, I cannot find the documentation on how to do this using activities api or from the photoslibrary api. I have tried the photoslibrary api mediaitems.search, however, it does not seem to include photos_likes as a metadata value.

Which metadata value or tag from the photoslibrary api mediaitems.search can I use to find liked photos in shared albums? if this is the wrong api, which one should I use?

4

There are 4 best solutions below

0
On

I don't know if we are talking about the same feature, but I've just been able, with the api explorer, to retrieve a photo I "starred" (favorite).

Please use this link to the api.

If it doesn't fill the body of the request, here it is :

{
  "filters": {
    "mediaTypeFilter": {
      "mediaTypes": [
        "PHOTO"
      ]
    },
    "featureFilter": {
      "includedFeatures": [
        "FAVORITES"
      ]
    }
  }
}

So you would try to POST this body to https://photoslibrary.googleapis.com/v1/mediaItems:search or adapt it for the gapi.client

Response structure :

{
  "mediaItems": [
    {
      "id": "XXX",
      "productUrl": "https://photos.google.com/lr/photo/YYY",
      "baseUrl": "https://lh3.googleusercontent.com/lr/ZZZ",
      "mimeType": "image/jpeg",
      "mediaMetadata": {
        "creationTime": "2021-09-05T11:25:23Z",
        "width": "4608",
        "height": "3072",
        "photo": {
          "cameraMake": "NIKON CORPORATION",
          "cameraModel": "NIKON D3100",
          "focalLength": 18,
          "apertureFNumber": 6.3,
          "isoEquivalent": 100,
          "exposureTime": "0.004999999s"
        }
      },
      "filename": "DSC_0083.JPG"
    }
  ]
}

Please let me know if this answer is relevant, I hope so ;)

(ok, this is not javascript, but credentials is another nightmare :D )

0
On

Try passing in file extensions parameters as an object, specifying it in the "filters"? See here for reference: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/search

{
  "albumId": string,
  "pageSize": integer,
  "pageToken": string,
  "filters": {
    object (Filters)
  },
  "orderBy": string
}
1
On

So far (05 October 2021), this feature is not available, you can just filter it by favorite (which is not what you want).

I open an issue to ask a feature improvement, you can star it to make it more visible to the Google Photos API team : https://issuetracker.google.com/issues/202032850

0
On

try passing file extensions as parameters to mediaitems.search i.e.: mediaitems.search(jpg,png)