获取Facebook Graph api页面审查 [英] get Facebook Graph api page review
问题描述
我正在尝试从某些地方获取评论/评价,其中fb页面可以如下所示:
I'm trying to get review/rating from certain place whos fb page can look like this i.e :
https://www.facebook.com/pages/Dell-Rheas-Chicken-Basket/183254918389428
所以这个地方/页面的ID是 183254918389428
So id of this place/page is 183254918389428
你可以得到详细信息的评论/评论:
And you can get the details of this place but not rating/review:
https://graph.facebook。 com / 183254918389428
我发现在这个论坛的某个地方,你可以从这样的页面得到评论:
I found somewhere on this forum that you could get review from page like this :
https://graph.facebook.com/183254918389428/tabs/reviews?access_token=xxx
但是我总是没有数据:
{
"data": [
]
}
So I'm not trying to get app review/rating but for certain place.
推荐答案
您需要一个页面访问令牌才能获取评论和评分。以下是获取页面访问令牌的非常好的简短教程:获取页面访问令牌。
You'd need a page access token to fetch reviews and ratings. Here is a very good short tutorial on getting a page access token: Obtaining page access token.
https://www.facebook.com/dialog/oauth?client_id=<APP_ID>&redirect_uri=<REDIRECT_URL>&scope=manage_pages&state=<STATE>
这将产生一个 CODE
,使用该代码位于:
This will generate you a CODE
, use that code in:
https://graph.facebook.com/oauth/access_token?client_id=<APP_ID>&client_secret=<APP_SECRET>&code=<CODE>
这将返回一个包含短命令用户访问令牌的json响应。
This will return you a json response containing short lived user access token.
接下来,使用短命令用户令牌获取长寿命用户令牌:
Next, use the short lived user token to get long lived user token:
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=<APP_ID>&client_secret=<APP_SECRET>&fb_exchange_token=<SHORT_LIVED_TOKEN>
这将返回另一个包含长寿命用户令牌的json,现在可以将其交换为页面访问令牌:
This will return another json containing the long lived user token, you can now exchange it for page access token:
https://graph.facebook.com/me/accounts?access_token=<LONG_LIVED_TOKEN>
这将返回一个与该用户帐户关联的页面的页面访问令牌的json 。使用此页面访问令牌将其传递到:
This will return you a json with page access token of the page(s) associated with that user account. Use this page access token to fetch ratings and reviews by passing it to:
https://graph.facebook.com/StoneArmsInc/ratings?access_token=<page_access_token>
您将获得该页面上Facebook的所有评分。
And you will get all the ratings posted on facebook for that page.
希望,这有助于某人。 :)
Hope, this helps someone. :)
这篇关于获取Facebook Graph api页面审查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!