How to get posts that user's friend posted on

2019-03-04 07:35发布

问题:

I am trying to build a Chrome extension and I want to get all the posts that people posted on the user's wall specifically on his birthday.

I tried to call through Facebook Javascript SDK, but it is not returning the posts that are posted by my friends on the birthday.

FB.api(
  '/me/feed',
  'GET',
  {},
  function(response) {
      // Insert your code here
  }
);

Rather, it is returning all the birthday posts in one post like this:

{
      "message": "Belated happy birthday bhaiii.....",
      "created_time": "2015-10-19T00:02:02+0000",
      "id": "578828115566706_848912165224965"
    },
    {
      "story": "Ritwik Jain and 40 others wrote on your Timeline.",
      "created_time": "2015-10-18T03:59:39+0000",
      "id": "578828115566706_848604468589068"
    },

How do I get each post individually?

Thanks in advance.

回答1:

As you found out, the /me/feed endpoint is what you need to use - with the user_posts permission, of course. Facebook puts birthday posts together as it seems, but there is no other way to get the posts. Meaning, there is no way to get the birthday posts separately.

Endpoints for the user wall: https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed