How do I access a facebook page's tabs data in the Graph API
According to the facebook developer's article on pages, pages have a tabs connection. It says common tabs can开发者_如何学JAVA be accessed by a plain text string.
When I try to access the tabs data on my page, an OAuthException error is flagged stating the subject must be a page.
Any ideas why my page is throwing this exception?
Page ID is:136789689670650
When I use the graph to query my information on the root, 136789689670650, my page information is pulled up. When I use the graph to query my information on the tabs, 136789689670650/tabs/reviews, the exception is thrown.
Thanks.
You need to do things in this order to access a pages tabs:
Send an HTTP GET to https://graph.facebook.com/USER_ID/accounts
, where user_id is the page owner. You can also do /me/accounts
if it's your own page.
This will return a JSON data structure like this:
{ data: [ { name: "Page Name", access_token: "Page Access Token", category: "", id: "136789689670650", } ] }
data is an array of all pages admin'd by that user. Each page has it's own access_token that you need to use for your next request.
Once you have the page access token you can send a request to /136789689670650/tabs/reviews
using your page access token.
精彩评论