1

what happens when a Facebook page is queried for its feed with Facebook Graph API (JS SDK) and a URL parameter fields (like for the post object) is added?

I would like to load from the feed only the posts id's, shares, likes and comments, because the page is pretty active and the text data in JSON for 2 days is about 2MB (25 items)...

I would hope one could do like this: FB.api('/SomePage?fields=id,shares,likes'), but I suppose the only fields you can access are the direct children (for feed, that is data & paging)? If this unfortunately is the case, is there any other way to retrieve all posts from date x to date y without downloading the entire feed?

webketje
  • 10,376
  • 3
  • 25
  • 54

1 Answers1

2

That's not correct. The feed edge is basically an array of Post objects. You can use the Field Expansion together with time pagination as follows:

GET /{page_id}/feed?fields=id,shares,likes.summary(true)&since={start_unix_timestamp}&until={end_unix_timestamp}

See

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • Thanks, I didn't know about the nestable fieldexpansion options! Unfortunately I will have to make individual API calls for posts anyway with the paging set. – webketje Feb 10 '15 at 22:29
  • Why do you have to call individual Posts? – Tobi Feb 11 '15 at 07:34
  • Because I need all the likes and comments on a post, but it only gives you the 25 first items. So I have to make more calls for the likes,eg `/{post-i}/likes?after=...` – webketje Feb 11 '15 at 11:51