Search code examples
facebookfacebook-graph-apifacebook-likefacebook-comments

How to get data of post on facebook like comments, picture by graph api


I using graph api to post picture to wall of user, after get postid i try to get post data by graph api follow this url:

https://graph.facebook.com/v2.4/postid?access_token=my_access_token

But result return only has message, created_time, id

{
   "created_time": "2015-09-10T01:52:18+0000",
   "message": "test",
   "story": "Minh D\u01b0\u01a1ng added 2 new photos to the album: test_demo_app Photos.",
   "id": "507382632760376_508325799332726"
}

So, how to get other data of post such as comments, picture in story, likes ?


Solution

  • Please have a look at the docs first. Since v2.4 you have to specify each field you want to be returned from the Graph API. See

    Declarative Fields To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.