How can I get the user ID of facebook page admins.?

How can I get admins user id on facebook page using grapg. API?

For example: This will give information about the KFC page

https://graph.facebook.com/126380033352 { "id": "126380033352", "name": "I Love KFC", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/50510_126380033352_4943708_s.jpg", "link": "http://www.facebook.com/Official.KFC", "likes": 543485, "category": "Food/beverages", "username": "Official.KFC", "founded": "1929", "about": "KFC United Kingdom. Finger Lickin' Good.", "can_post": true, "talking_about_count": 8965, "type": "page" } 

Do I need to get the user id of the admin page ..? I checked the permissions, but I don't know how to get this.

+1
source share
4 answers

First: The user must be the administrator of this page.

With the permission "manage_pages", request GET https://graph.facebook.com/[PAGE_ID]?fields=access_token In response, you will get the admin access_token page. Now use the admin access_token page to request a GET https://graph.facebook.com/[PAGE_ID]/admins

In response, you will receive a list of administrators, their identifier and usernames.

Link: http://developers.facebook.com/docs/reference/api/page/

+5
source

You cannot get all the application admin users, but you can test any uid.

First, you need to grant permission to manage_pages, and then query the page_admin table. The FQL implementation for the current user is as follows:

 $isAdmin = false; $hasManagePerm = false; try{ $responses = $facebook->api('fql', 'GET', Array('q' => Array( 'hasManagePerm' => 'SELECT manage_pages FROM permissions WHERE uid=me()', 'isAdmin' => 'SELECT 1 FROM page_admin WHERE uid=me() AND page_id=' . APP_FB_ID, ))); foreach ((Array)$responses['data'] as $response) { if($response['name'] == 'hasManagePerm') { $hasManagePerm = !empty($response['fql_result_set'][0]['manage_pages']); } else if($response['name'] == 'isAdmin') { $isAdmin = !empty($response['fql_result_set']); } } } catch (Exception $ex) { } if(empty($hasManagePerm)) { throw new AdminPanelAccessRestrictedException("perm"); } if(empty($isAdmin)) { throw new AdminPanelAccessRestrictedException("admin"); } 

WHERE APP_FB_ID - application identifier

0
source

If you don't like Graph objects, you can always use FQL

fql?q=SELECT uid, page_id, type FROM page_admin WHERE page_id = {pageId}

returns this:

 { "data": [ { "uid": "6905135096", "page_id": "{pageId}", "type": "ATHLETE" }, { "uid": "14408356540", "page_id": "{pageId}", "type": "ATHLETE" }, { "uid": "51936644133", "page_id": "{pageId}", "type": "ATHLETE" }, { "uid": "7230226073", "page_id": "{pageId}", "type": "ATHLETE" } ] } 
0
source

@Sarim link '/ admins' is deprecated after Graph API 2.1.
FB Graph API 2.2 and higher use '/ role'

-1
source

All Articles