Reputation: 5747
I have a facebook app that I would like to get the total number of "likes" from. I am wondering if this is even possible.
where ID
is the app's id and ACCESS_TOKEN
is the current access token for the app I have tried:
graph.facebook.com/ID
which returns the basic json information for the app but does not include likes.
graph.facebook.com/ID/likes?access_token=ACCESS_TOKEN
which returns an empty tuple of data, ie. {"data":[]}
. The page has been liked and this tuple doesn't change when I like the application.
Is there any way to get the total likes for an app from facebook and if so what is the api call?
edit: if it helps to clarify the url for the page that I am trying to get likes from is http://www.facebook.com/apps/application.php?id=ID&sk=PAGE_NAME
Upvotes: 3
Views: 2448
Reputation: 43816
It's not currently available as easily as page likes which is a parameter of a Page object , but you can get this from the insights api with the read_insights permission
Just make a call to https://graph.facebook.com/[APP ID]/insights/page_fans/lifetime/?access_token=ACCESS_TOKEN
Sample return value (App ID removed):
{
data: [
{
id: "[APP ID]/insights/page_fans/lifetime",
name: "page_fans",
period: "lifetime",
values: [
{
value: 4,
end_time: "2011-07-23T07:00:00+0000",
},
{
value: 4,
end_time: "2011-07-24T07:00:00+0000",
},
{
value: 4,
end_time: "2011-07-25T07:00:00+0000",
},
]
description: "Lifetime The total number of people who have liked your Page. (Total Count)",
},
]
paging: {
previous: "https://graph.facebook.com/[APP ID]/insights/page_fans/lifetime?since=1311088931&until=1311348131",
next: "https://graph.facebook.com/[APP ID]/insights/page_fans/lifetime?since=1311607331&until=1311866531",
}
}
(In this case the number of fans has been static at 4 for the past three days, on a busier app this will fluctuate)
Upvotes: 2