skip to Main Content
GET▾→ /v2.7▾/pepsi?fields=fan_count

I am new to graph API, I am interested in getting the facebook fan counts for different pages.
Using Facebook Graph API explorer, the above code gives me for only 1 page,
but if I want to get the fan counts for different pages – What should be the code ?
For example- I tried GET▾→ /v2.7▾/coke,pepsi?fields=fan_count
but got the error —

{
  "error": {
    "message": "(#803) Some of the aliases you requested do not exist: coke,pepsi",
    "type": "OAuthException",
    "code": 803,
    "fbtrace_id": "FqAQ297ssFe"
  }
}

2

Answers


  1. Not sure why you believe this would be possible, but you need to do two API calls for two Pages. You can only make the API calls faster with batch requests, check out the docs for more information: https://developers.facebook.com/docs/graph-api/making-multiple-requests

    They still count as separate API calls though, but it will be as fast as the slowest API call in the batch.

    Login or Signup to reply.
  2. https://developers.facebook.com/docs/graph-api/using-graph-api/#multiidlookup

    You can make a single GET request that retrieves multiple nodes by using the ?ids endpoint with the object IDs of those nodes.

    So the request you want to make is: ?ids=coke,pepsi&fields=fan_count


    You can retrieve data for up to 50 objects in one go this way.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search