Search code examples
facebook-graph-apifacebook-graph-api-v2.1

Facebook Graph API 2.1 feed attachments


According to Facebook Platform Changelog

/v2.1/{post-id} will now return all photos attached to the post: In previous versions of the API only the first photo was returned with a post. This removes the need to use FQL to get all a post's photos.

Though this statement is applicable only for separate API calls per post that looks follows:

https://graph.facebook.com/v2.1/{post_id}?fields=attachments

Since I need to retrieve all possible data that user posts to timeline, I use corresponding feed edge to do so.

https://graph.facebook.com/v2.1/me?fields=feed

So when I make a post with more than one picture attached to it, retrieved API response doesn't reflects that (and as I understand it's is per design). However I found that Graph API Explorer allows to choose attachments edge while constructing feed query that in this case appears like this

https://graph.facebook.com/v2.1/me?fields=feed{attachments}

but execution of such request triggers "Unsupported get request" exception.

Summing it up, the whole issue with the approach to make separate API calls for pictures is that it will dramatically increase number of calls which in turn not only decreases overall performance of the processing algorithm, but also leads to failing API call limits restrictions that in my case is unacceptable.

So I'm curious, is there any possibility to retrieve all post attachments (i.e. pictures) while working with feed edge or any alternative approach?

Thanks.


Solution

  • The issue eventually resolved itself.

    I found that Graph API Explorer allows to choose attachments edge while constructing feed query that in this case appears like this

    https://graph.facebook.com/v2.1/me?fields=feed{attachments}

    but execution of such request triggers "Unsupported get request" exception.

    It seems like non-working attachment edge for feed was unimplemented feature or a bug, because, surprisingly, now all attachments are retrieved successfully as subattachments collection.

    Thanks, everybody.