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

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?

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}

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
}
}

You cannot. Once a page has been merged the Graph API will no longer provide data on that Page using the old Page ID.
I do not believe there is any indicator that the page has been merged a Graph API layer.

Related

Facebook Graph API - overall_star_rating and rating_count Fields Not Populating in v2.10

I'd like to get the overall_star_rating and rating_count fields for the Facebook pages for several companies. The Facebook Pages docs show that this information should be available, yet I can't get fields to populate.
Example:
Querying information for a local company, Utah Projectors.
Facebook Page: https://www.facebook.com/utahprojectors/
Facebook Page ID: 152868571589318
Overal Star Rating: 4.8
Rating Count: 13
When I go to the Facebook Graph Explorer and query use the query string 152868571589318?fields=name,overall_star_rating,about,rating_count I get the following response:
{
"name": "Utah Projectors",
"about": "We provide the best projectors around with the best service possible, all while keeping it local and personal.",
"rating_count": 0,
"id": "152868571589318"
}
You'll notice that the overall_star_rating isn't even included in the results (even though I requested it), and the rating_count doesn't show the correct number of ratings (which should be 13). I've tried changing my access token to just about everything I can think of - Using the Graph API Explorer tokens, using my Facebook App tokens (User Access Token, App Token, Page Access Tokens), and just about every combination I can think of. Clearly, I'm missing something.
What's even more curious is that I swear I was able to successfully query this information not more than a couple weeks ago! But I can't seem to get anywhere today. Please help! Any advice would be greatly appreciated!
This was a legit bug on Facebook's end, but it looks like they have fixed it. Details can be found here: https://developers.facebook.com/bugs/1816620328365587/

Discrepancy in Facebook Graph API Documentation Regarding Page Likes (Incoming vs Outgoing)?

I'm looking at the Facebook Graph API documentation and noticed something odd, or maybe I'm misunderstanding something.
This page here: https://developers.facebook.com/docs/graph-api/reference/v2.9/page/likes describes /{page-id}/likes as returning "The Pages that this Page Likes"
However, this page: https://developers.facebook.com/docs/graph-api/reference/v2.9/object/likes (which seems to be describing the same endpoint if a {page-id} is passed in for {object-id} is saying that it returns "An array of User or Page objects representing the people or Pages that liked the object".
The first link says /{page-id}/likes will return outgoing likes for a page, whereas the second link suggests the same endpoint will return incoming likes. Testing it out in the Graph Explorer indicates that the 2nd link is true, which makes me wonder how I can access the outgoing likes described by the first link, as that is what I am interested in.
Am I misunderstanding something here? Thanks!
This is a bug in the Facebook documentation: https://developers.facebook.com/bugs/638061899718019/

Post via open graph to Company Page NOT user

As I am learning and getting familiar with the FB OG API I am finding that I am lacking some of the basics. For example I see here that I use the action type news.publishes to post an article. However the access_token is for the user owning the page and thus it will go to their news feed and not the page (in this case their company page). Correct?
If I understand correctly then how does one get it to post to a specific page. Is there an access_token collection you iterate through till you find the one for the company page?
TIA
JB
You should be able to use /PAGE_ID/feed? Where page id is the numerical assigned by facebook..or the text friendly name you used.

Page migrated error in Graph API

In my Facebook application, when I query info about a Facebook page through the open graph API, I regularily see errors like (#21) Page ID 290260024371666 was migrated to page ID 122581454447308. Please update your API calls to the new ID when querying the open graph API.
What is this migration? How do pages migrate to another? Is that something that can happen anytime?
Can happen anytime when user merge his fanpage with a other page of similar name.
Happens also for Places movie and many other object.
Would be nice if the Graph Api would return a extra field with new PageID .

Graph API's search returning considerately less public posts than Facebook's user facing search?

I'm developing an application based on facebook's data using the Graph API. Part of the functionality entails searching Facebook's public post, essentially in the same fashion that Facebook does on www.facebook.com/search:
http://www.facebook.com/search/results.php?q=thanksgiving&type=eposts&init=quick&tas=0.31611707084812224
However, when I issue the same search via the Graph API, the results return miss many of the posts shown in the standard user interface. Many of the most recent posts returned by the standard search are missing (replace the access_token to the one you have):
https://graph.facebook.com/search?q=thanksgiving&type=post&access_token=XXXX
Does anyone have an idea what can cause this and how I can work around it? I have customer questioning the quality of my application because of this difference.
Many thanks,
Boaz
That is because the Graph API uses pagination if it returns too many objects, if you take a look on the bottom of the response of the "Nike" search you will find this:
"paging": {
"previous": "https://graph.facebook.com/search?q=nike&type=post&access_token=XX&limit=25&since=1322257702&__previous=1",
"next": "https://graph.facebook.com/search?q=nike&type=post&access_token=XX&limit=25&until=1322246079"
}
Just make another request to the "next" url in order to fetch more results.