I'm able to retrieve the number of comments, shares and likes for a post of a Facebook page but I can't find a way to retrieve the number of likes (or "fans") a page has.
It is stated in the documentation that "To retrieve the number of likes for a page, use getUsers with the page IDs.".
My problem is that the getUsers()
function return an error and getPage()
contains no information regarding the number of fans, but only the number of likes per every single post.
> install.packages("Rfacebook")
> library(Rfacebook)
> token <- "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
> getUsers("179106818789009", token=token)
Error in callAPI(query, token) :
(#100) Tried accessing nonexisting field (first_name) on node type (Page)
>
How can I find this information ?
A workaround that uses the Facebook API with an url as proposed in another question also return an error :
https://graph.facebook.com/cocacola/?fields=fan_count&access_token=MY_TOKEN_HERE
{
"error": {
"message": "(#12) fan_count field requires version v2.6 or higher",
"type": "OAuthException",
"code": 12,
"fbtrace_id": "F8JOCmpvFnX"
}
}