Home > database >  Facebook API - How do I filter the pages to get the page access token when getting the list of accou
Facebook API - How do I filter the pages to get the page access token when getting the list of accou

Time:06-09

I'm currently sending a GET request to {user_id}/accounts?access_token={accessToken}&filtering=[{ "field": "id", "operator": "EQUAL", "value": ["{pageId}"] }] and it's throwing me the paginated list of pages that user has permissions for. However, I'm getting the entire list (paginated) at once and cannot filter by the pageId.

Is there a way where I can filter out a specific page token out of all the pages in the list? As seen on the query, I'm utilizing the filtering query param but not getting any real filtering.

Am I doing something wrong or is it impossible for me to directly do it through their endpoint and I need to query through all of the pages and manually filter it out?

CodePudding user response:

If you already know the page ID, then you can go directly via the pages endpoint:

https://graph.facebook.com/{PAGE-ID}?fields=access_token&access_token=USER-ACCESS-TOKEN

https://developers.facebook.com/docs/pages/access-tokens#get-a-page-access-token

  • Related