Ravinder Singh
Ravinder Singh

Reputation: 3133

How to get all facebook pages id associated with my account?

I want to get the statistics of all the pages associated with my account on facebook, i have the code to get the statistics of a page, i just want to get the page id of all the pages associated with my account, how can i do this? Please help. Thanks.

Upvotes: 1

Views: 692

Answers (2)

Lix
Lix

Reputation: 47986

You'll need to request the manage_pages permission (more details here), once you have the aquired the permission, all you have to do is make a request to :
https://graph.facebook.com/YOUR_FACEBOOK_ID/accounts.
The return value will be a JSON with all the pages/applications that are associated with your account.

You can also use this great tool that facebook provides - The Graph API Explorer (/me/accounts) to explore what other information you can retrieve without having to write a single line of code :P very useful.

Upvotes: 1

hungneox
hungneox

Reputation: 9829

    FB.api('/me/accounts', function(response) {
        for (id in response.data)
        {
            page = data[id];
            page.id;
            page.name;
        }           

    });

You can use Javascript API to do this, read more :http://developers.facebook.com/docs/reference/javascript/

Upvotes: 0

Related Questions