Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API does not return full post data

I'm using the Facebook Graph API to fetch a public page feed. I created a basic application to get appId and secret. When I make a call to PUBLIC_PAGE_ID/feed I can retrieve the correct list of posts in JSON, but they are missing all the field I need, described in docs, and only have message, created_time and id:

{
  "data": [
    {
      "message": "...",
      "created_time": "2015-06-11T07:57:05+0000",
      "id": "23X12XXXXXX9836_11XXXXXXXX610XXXX52"
    }, 
    ...

Why all other data isn't there?

like image 575
lorenzo-s Avatar asked Dec 06 '22 21:12

lorenzo-s


1 Answers

The response to your query: /id/feed is the default response. To access more data, you have to pass a fields parameter with the keyword of data you would like to retrieve.

For example: <id>/feed?fields=id,message,picture,shares

This will return:

{
  "data": [
    {
      "id": "1234567890",
      "message": "Message",
      "picture": "http://fbcdn.com/xxxxxx.jpg",
      "shares": {
        "count": 0
      }
    }
}
like image 161
Nishant Ghodke Avatar answered Jan 19 '23 00:01

Nishant Ghodke