Facebook graph API not respecting aliases
I have a list of URLs of Facebook Pages that I'd like to collect basic metadata from (likes etc).
Most of the time, given a URL:
https://www.facebook.com/cocacola
I can simply fetch the corresponding graph URL:
https://graph.facebook.com/cocacola
Unfortunately, this breaks down for pages whose name has changed:
http://www.facebook.com/bebestores (redirects to https://www.facebook.com/bebe)
The resulting graph URL:
http://graph.facebook.com/bebestores
returns:
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: bebestores",
"type": "OAuthException",
"code": 803
}
}
Can I have the Facebook Graph API follow this redirect, or do I need to hit the public website to check whether my URL redirects?
The best thing to do is use the page id
, this never changes.
For bebe
the id is 46215732881
so you can always get the information by using http://graph.facebook.com/46215732881
and not worry about the name changing.
Another option is to provide the full URL:
http://graph.facebook.com/http://www.facebook.com/bebestores
I would use this url to get the id
and use the id
after that.
上一篇: Graph API没有公开页面信息
下一篇: Facebook图形API不尊重别名