Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FB Graph API - How do I detect if a page was merged and get the ID of the right page?

Pages can be merged using this procedure https://www.facebook.com/help/249601088403018. After the merge one of the pages redirects to the other.

Is the only way to detect this by fetching the page and see if Facebook does a redirect? Or is there no way to use the Graph API to get this information?

like image 265
PvdL Avatar asked Mar 06 '14 14:03

PvdL


People also ask

What data can I get from Facebook Graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

Is Facebook Graph API deprecated?

API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.


2 Answers

Just wanna add my two cents to this. Another behavior I've come across is the graph API throwing an error, mentioning that the page has been migrated and should be referenced by a new ID:

{
  "error": {
    "message": "Page ID 763809000301020 was migrated to page ID 697230513732818.  Please update your API calls to the new ID", 
    "type": "OAuthException", 
    "code": 21
  }
}
like image 33
BadgerBadgerBadgerBadger Avatar answered Sep 19 '22 11:09

BadgerBadgerBadgerBadger


I know this answer is probably coming 1 year too late, but this question was asked and answered by Baz at Programmatically detect if a Facebook page was merged with another page. I've tested his solution on the Graph API Explorer and it works. To quote his answer,

There is a field called "best_page" that gives the best alternate id of the page you are querying.

He specifies

If the page you are querying is already the best page, you will not receive any "best_page" property in the response

He extrapolates by saying,

if you are querying all of a user's likes, and would like to know the best page of each without having to re-query each page individually, you can use it with the likes endpoint:

/v2.1/me/likes?fields=id,name,best_page{id} 
like image 73
Joe B. Avatar answered Sep 18 '22 11:09

Joe B.