Facebook Graph API: Get Photos in a Group Album

Before I ask for some information that I can already achieve:

  • I can get a group feed in JSON format

    • I am addressing the group. I have a long lived access token and can access the feed.
    • The inputs that I have are: group_id

      , acess_token

      .
    • USED ​​URL:
      https://graph.facebook.com/v2.1/{group_id}/feed?access_token={access_token}


      • The url gave JSON formatted output of all messages, etc.
  • I can get band albums

    • USED ​​URL:
      https://graph.facebook.com/v2.1/{group_id}/albums?access_token={access_token}

      • The url gave all the albums JSON formatted (their IDs, name, etc.).
  • What I cannot achieve :

    • USED ​​URL:
      https://graph.facebook.com/v2.1/{album_id}/photos?access_token={access_token}

    • USED ​​URL:
      https://graph.facebook.com/v2.1/{album_id}?fields=photos&access_token={access_token}

    • USED ​​URL:
      https://graph.facebook.com/v2.1/{album_id}/photos?fields=picture,source,name&type=uploaded&access_token={access_token}

      {
          "data": [
      
          ]
      }
      
            

    • I even tried this on "Graph API", I get the same result.

    • I have tried using various group ids to determine if some group ids are the source of the problem. But I am getting the same result as above.
    • I've gone over all the related Stack Overflow questions. I am using the same urls shown in the posts. They say they can see the photo data in JSON.
+3


source to share


1 answer


Due to permission restrictions, it is not possible to get all photos from group albums unless the user has uploaded these albums themselves.

The link A link to the graphics API means that you must do one of the following to retrieve a regular album:

  • Any valid access token if the album is open.
  • The user token user_photos is allowed to retrieve any albums that the session user has uploaded.

Oddly enough, the edge /{group_id}/albums

is undocumented . Here's what I learned from the experience of accessing the band's albums:

  • A user access token with user_photos permission will allow access to album information and photos for albums that have been uploaded by the user.
  • Any attempt to access any album that the user has not downloaded (including public albums in public groups) will return album data, but not photo information.

You have used the correct queries. For completeness, I'll return them here.



Album information

https://graph.facebook.com/v2.1/{group_id}/albums?access_token={access_token}

Photo

https://graph.facebook.com/v2.1/{album_id}?fields=photos&access_token={access_token}

You can access photo attachments (but not albums) with /{group_id}/feed

+3


source







All Articles