Facebook API for getting likes count - facebook

Can anyone help me how to get my page like count of facebook to show on my website. I have tried
https://graph.facebook.com/<YOUR_PAGE_NAME>/?fields=fan_count&access_token=<EAAUo6u... - YOU_ACCESS_TOKEN>
but not able to get data. Error shows :
{
"error": {
"message": "(#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.",
"type": "OAuthException",
"code": 10,
}
}

https://developers.facebook.com/docs/apps/review/feature/#reference-PAGES_ACCESS
You can either use a Page Access Token of your Page, or you need to go through review in order to get access with an App or User Access Token.

Related

Fetch public photo sources from my facebook page

I'm trying to fetch the public photos I've posted on my facebook page.
With that, I plan to make a caroussel on my website that displays the photos I posted on my facebook page.
Using the facebook Graph API, I ended up with this:
my-page?fields=albums.fields(photos.fields(source))
The thing is that the response I get is:
{
"error": {
"message": "(#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "DxhgQ12ym3r"
}
}
I've tried to get the app reviewed, but at certain point they ask me to attach a video in which I show how the final user will use the app. But this is a server-to-server app, so I don't understand how am I supposed to answer that petition.
I've also tried to get a page access token, but I get the following error:
Invalid Scopes: manage_pages. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions
I'm quite lost, if anyone could guide me a bit or explain me step by step how to reach my goal...

Accessing Facebook Page Posts in Development

I'm trying to get page data as the Administrator of my Facebook App but I'm getting error #10: To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook.
I thought that as an Administrator I would have access for testing purposes? Is my request incorrect? I've made this as simple as possible by using JavaScript, so no server side code at all.
My AppID and AppSecret are as defined on the Settings/Basic page of https://developers.facebook.com
Please advise:
var getAccessTokenURL = 'https://graph.facebook.com/oauth/access_token?type=client_cred&client_id='+appID+'&client_secret='+appSecret;
httpGetAsync(getAccessTokenURL, function(text) {
var json = jQuery.parseJSON(text);
var accessToken = json.access_token;
var url = 'https://graph.facebook.com/' + pageID + '/feed?access_token=' + accessToken;
httpGetAsync(url, function(text) {console.log(text);})
})
My response is:
{
"error": {
"message": "(#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.",
"type": "OAuthException",
"code": 10
}
}
Apologies if this is obviously or has already been asked, I've had a look but cannot find clear documentation about this
Thanks
You need to use a Page Token, and test with a Page you manage.
Links:
https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens
https://developers.facebook.com/docs/apps/review/feature/?locale=de_DE#reference-PAGES_ACCESS
To get api access to public published page data:
Create an app for the facebook page:https://developers.facebook.com/apps/
Generate a "User Access Token": https://developers.facebook.com/tools/explorer/
Extend the token to be used for 60 days: https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=APP_ID&client_secret=APP_SECRET&fb_exchange_token=ACCESS_TOKEN
Where APP_ID and APP_SECRET are on the Facebook app under Settings->Basic
Get page info: https://graph.facebook.com/v3.2/PAGE_ID?access_token=ACCESS_TOKEN
Get posts: https://graph.facebook.com/v3.2/PAGE_ID/feed?access_token=ACCESS_TOKEN

Facebook: get event information for public page

My Facebook page publishes public events and I am developing an app that uses this page. I want to get the number of interested/going people for a specific event given its Facebook id.
I, the creator of the app, am also the admin of the page. However, using my app access token that I generated with the app id and the app secret, I can't call the event API: https://graph.facebook.com/v3.0/137340177139954?access_token={access_token}
I get the following error
{
"error": {
"message": "Unsupported get request. Object with ID '137340177139954' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "FqJ5oAqdukA"
}
}
What am I doing wrong? How do I get event information about a page that I own
The endpoint that you're hitting is not correct. You're forgetting the /events portion after your page_id.
This is what it should look like:
https://graph.facebook.com/v3.0/137340177139954/events?access_token={access_token}

Can't retrieve posts from facebook public page via facebook API

Yesterday on the Facebook Graph API tool I could create an access_token without having to own an App then get posts/publications via {page-id}/posts or {page-id}/feed.
Today, first thing when I arrive on the Facebook Graph API tool is that I have to create an application to have access then after creating it with the same operation than before it returns me an error like this
{
"error": {
"message": "(#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "FJ52hd03hq"
},
"__debug__": {}
}
Then I went see someone owning a verified application so I can try with an access_token generated with his application. The result is the same.
Anyone facing the same problem ? Did I missed something ?

Can you get a page access token for a page you do not own, ie you are a third party ? (FB insights)

Would like to use these FB Graph API insights endpoints for the Nike FB page.
https://developers.facebook.com/docs/graph-api/reference/v2.12/insights
But, every time I go to the developers.facebook.com tools and generate a new "Page Access Token" and then try to type in the endpoint, I get this error:
{
"error": {
"message": "(#190) This method must be called with a Page Access Token",
"type": "OAuthException",
"code": 190,
"fbtrace_id": "CWg3K5qBxk+"
}
}
Page Tokens are for Page owners only. Think about it this way: Would you be able to get access to Google Analytics of some website you do not own? Of course there is also no way to access the Facebook Insights of a Facebook Page you do not own.
I believe you cant get access to info insights.
However you can get some info from the API
For instance:
'Nike?fields=fan_count,pharma_safety_info,phone,description'
returns:
{
"fan_count": 32788277,
"description": "Just Do It. ",
"id": "15087023444"
}