Why can't I see all stats for object from Facebook Graph API
Question: I'm using the [Python SDK for Facebook's Graph
API](https://github.com/mobolic/facebook-sdk) to fetch how many times a
Facebook page has been liked. I went to the [API
Explorer](https://developers.facebook.com/tools/explorer/) to obtain an access
token. The first time I chose the "Graph API Explorer" from the drop-down menu
for the Application (top-right). I then ran this code and got back what I
expected:

    
    
    import facebook
    
    ACCESS_TOKEN = "**********"
    
    facebook_page_id = "168926019255" # https://www.facebook.com/seriouseats/
    graph = facebook.GraphAPI(ACCESS_TOKEN)
    page = graph.get_object(facebook_page_id)
    
    print page
    
    {u'about': u'The Destination for Delicious',
     u'can_post': True,
     u'category': u'Website',
     u'checkins': 0,
     u'cover': {u'cover_id': u'10154881161274256',
      u'id': u'10154881161274256',
      u'offset_x': 0,
      u'offset_y': 43,
      u'source': u'https://scontent.xx.fbcdn.net/t31.0-0/p180x540/13391436_10154881161274256_2605145572103420621_o.jpg'},
     u'founded': u'December 2006',
     u'has_added_app': False,
     u'id': u'168926019255',
     u'is_community_page': False,
     u'is_published': True,
     u'likes': 159050,
     u'link': u'https://www.facebook.com/seriouseats/',
     u'mission': u'Serious Eats is a site focused on celebrating and sharing food enthusiasm through recipes, dining guides, and more! Our team of expert editors and contributors are the last word on all that\u2019s delicious.',
     u'name': u'Serious Eats',
     u'parking': {u'lot': 0, u'street': 0, u'valet': 0},
     u'talking_about_count': 3309,
     u'username': u'seriouseats',
     u'website': u'http://www.seriouseats.com',
     u'were_here_count': 0}
    

I then went back to the API Explorer and changed the Application to my new
Facebook app that I created recently. I generated a new Access Token, swapped
it out, and ran the code above. This is the response I get back in the `page`
variable:

    
    
    {u'id': u'168926019255', u'name': u'Serious Eats'}
    

As you can see, it only returns the `id` and the `name` of the page but the
other attributes -- specifically the `likes` attribute -- are missing.

So, **do I need to give my application permissions to see all attributes for
an object?** I've tried generating an Access Token from my App Id & App Secret
but still get the same results.


Answer: There are two things to look here.

  1. Version of facebook API. In your first example when you got lots of result, you are using **version 2.2** (that is the default version of facebook python sdk). When you went and created new app in facebook, it has most likely used **version 2.6** as default. Therefore, it now only returns two to three fields and the rest you need to ask for. 

  2. Assuming you are indeed using version 2.6, how you can ask for is

to use the following code

    
    
    page = graph.get_object(id='168926019255', fields='about, affiliation, awards, category')
    

This will give you

    
    
    {'id': '168926019255', 'about': 'The Destination for Delicious', 'category': 'Website'}
    

Now you want to get the likes. Since likes are not a default field but an
"edge", you need to ask them using "connection". To do this, you can do the
following:

    
    
    page = graph.get_connections(id='168926019255', connection_name='likes')
    

This will now give you all the likes

    
    
    {'data': [{'id': '134049266672525', 'name': 'Tom Colicchio'}, {'id': '143533645671591', 'name': 'Hearth'}, {'id': '57909700259', 'name': 'Toro'}, ....
    

