Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook: get list of pages that a user is admin of

I'm using the graph api.

I have a logged in user, and want to get back a list of page ids of all the pages that the user is an admin of.

Is there a way of doing this? The docs are pretty bad - and circular.

like image 813
EoghanM Avatar asked Jun 03 '10 12:06

EoghanM


2 Answers

Its simple with Graph API. Steps:

  1. Get the manage_pages permission from the user (extended permissions).
  2. Call the Graph API - https://graph.facebook.com/me/accounts

You can test this procedure in the graph explorer -> Just click on 'Get Access Token' button-> under 'Extended permission' check 'manage_pages' & submit it. It will give you the admin-page-details JSON.

like image 160
Avisek Chakraborty Avatar answered Oct 14 '22 03:10

Avisek Chakraborty


I solved it with some FQL:

FB.api({method: 'fql.multiquery',         access_token: <access_token>,         queries: {             query1: 'select page_id from page_admin where uid = ' + <uid>,             query2: 'select page_id, name, page_url from page where page_id in (select page_id from #query1)'         }        }, function(queries){            var pages = queries[1].fql_result_set;        }} 
like image 37
EoghanM Avatar answered Oct 14 '22 04:10

EoghanM