1

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.

2 Answers2

1

This should work.

me/home?fields=attachments,<other stuff>
Wenger
  • 989
  • 2
  • 12
  • 35
  • 1
    Care to explain your solution a little bit? – everton Nov 13 '14 at 15:28
  • If you put that into the Graph Explorer, it'll give you the user's news feed with the attachments. Declaring fields means that you also have to include all the fields explicitly you want to retrieve. I do remember a while back, there was a bug in the API that would only return one picture of a given set. I'm not sure if that's been fixed yet. – Wenger Nov 13 '14 at 18:05
  • @Wenger, yes, it is possible to get attachments by using query you suggested, but **home** edge has such characteristic that the amount of posts that can be retrieved is limited to only few weeks of history and also include postings from your subscriptions. That's why I work with **feed** edge that corresponds to timeline page. Anyway, thank you for your reply. – Maksim Miron Nov 20 '14 at 13:43
1

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.