当前位置: 动力学知识库 > 问答 > 编程问答 >

facebook graph api - How to get for different pages get fan_count?

问题描述:

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.

The above code gives me for only 1 page,

but if I want to get the fan counts forn different pages - Wjhat shoud be the code ?

For Eq- 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"

}

}

网友答案:

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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: