how to retrieve facebook data from a page that is not mine - facebook-graph-api

I am working on automatic language processing, I want to retrieve data from facebook and build my dataset, the problem is that each time I try to retrieve this data, I encounter this problem:
{
"error": {
"message": "(#100) Page Public Metadata Access requires either app secret proof or an app token",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Azl7f9Wz5PDpX9K-dDIJ3xm"
}
}
I understand that the problem lies in the app token, but the concern is that I cannot get it and I don't know how to do it, is that possible?

Public meta data access does not cover this, the feed of a page is not meta data. You will have to submit your app for the Page Public Content Access feature.
The Page Public Content Access feature allows read-only access to public data on Pages for which you lack the manage_pages login permission.
Documentation on this can be found by clicking this link.

Related

Use Facebook GraphAPI to collect page data

I know that Facebook that restricted usage of its GraphAPI, but to what extent? I want to collect data from posts of this page (post content, likes, shares, date). Clearly I am not an admin of this page. When I try to do this using {page-id}/feed i get the message
{
"error": {
"message": "(#100) Page Public Metadata Access requires either app secret proof or an app token",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "A0xAYR0R1KdoDf_6h7EPr8O"
}
}
How can i collect the feed data?
The official Facebook documentation gives the answer:
Access to the Public Feed API is restricted to a limited set of media publishers and usage requires prior approval by Facebook. You cannot apply to use the API at this time.

Authorised Exception using access code which never expires

Using the Facebook Access Token Debugger I can see I have an access token that never expires.
https://developers.facebook.com/tools/debug/accesstoken/
However using the Graph Explorer I get the error
{
"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,
...
}
}
This was previously working, has something changed with Facebook? The only other thing that has changed is that my access to the Facebook App was removed then reinstated, so I now use a different access code.
Please could anyone advise what I need to do to resolve this issue, I previously did not need Facebook review to use this API last month.
Thanks
Edited: the login required screen when requesting a Page Access Token:
This is not about expiry of the token.
Facebook has restricted API access to the data of any public pages - you now need to get your app reviewed for the use of the feature “Page Public Content Access”, before you can use it.
https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS
Without getting this reviewed, you can only access data from pages you have admin access to - but that in turn requires the use of a different kind of token then, a page access token. (You presumably used the general app access token, for your requests that have been working up until now. For that to keep working to access public page data, you need to submit for review of the feature.)
Thanks to misorude for all your help. This is what worked for me:
Step 1: ask the business manager to grant the user "Manage Pages" permission on both the app and the page:
https://business.facebook.com/settings/pages/PageID?business_id=BusinessID
https://business.facebook.com/settings/apps/AppID?business_id=BusinessID
Step 2: Create the user access token (select "Get User Access Token" from the "Get Token" dropdown)
https://developers.facebook.com/tools/explorer/
Step 3: Check the user has access by calling your graph method using the temporary user access token
E.g. https://graph.facebook.com/v3.3/PageID?fields=link%2Cpicture&access_token=UserAccessToken
E.g. https://graph.facebook.com/v3.3/PageID/feed?fields=message%2Cfull_picture%2cpermalink_url%2Ccreated_time&limit=3&access_token=UserAccessToken
Step 4: Create permanent user access token
https://developers.facebook.com/tools/debug/accesstoken/
Click "Extend Access Token" at the bottom of the page and debug to reveal the token with expiry: never

What permissions are needed to call /{page-id}/ads_posts on Facebook Graph API?

I'm trying to list the Ads for a Facebook Page using the Graph API /{page-id}/ads_posts endpoint, but I get a permissions when I try to.
Using the Graph API Explorer, I generate an Page Access Token with those permissions: email, read_insights, manages_pages, pages_show_list, ads_read, business_management, instagram_basic, instagram_manage_insights and public_profile.
I'm an admin on the Page itself, the attached Business Manager and on the corresponding Ad Account.
Every time I try to call the /{page-id}/ads_posts, I receive
{
"error": {
"message": "(#200) Not enough permission to call this endpoint",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "XXXXX"
}
}
I can't find any help on the Facebook documentation or Google, given that the error isn't really meaningful (in some cases, I get a message saying that a specific permissions is missing, but not here). Anyone can help ?
EDIT: I tried to add the ads_management permission too, without success.
You need to add those pages to your app that is in development mode (https://www.facebook.com/settings?tab=business_tools).

Unable to retrieve data from facebook graph url for a page

Check out:
https://www.facebook.com/MitraJyothiorg
It is a page of an NGO.
Correspondingly, I should be able to find data of the page in:
http://graph.facebook.com/MitraJyothiorg
This does not seem to work. Any clues?
Please note: I am doing a simple http call and it usually works for other pages, for example, if i do the same thing for another page:teachforindia
The error message is quite clear:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
You need to add at least an App Access Token. See
https://developers.facebook.com/docs/graph-api/reference/page#Reading
For pages that are published, you need:
An app or user access token is needed to view fields from fully public pages.
A user access token is needed to view fields from restricted pages that this person is able to view (such as those restrict to certain demographics like location or age, or those only viewable by Page admins).
A page access token can also be used to view those restricted fields.
I am not able to access that page (get a 404 error). Maybe the page is still hidden? Then you will not be able to access it via the graph API imho.

Facebook Graph API not working anymore. No changes made

During the past couple of weeks I've been sporadically downloading posts from a couple of Facebook pages with this call:
https://graph.facebook.com/105317422843784/posts
Everything was working fine and I would get the usual json response of public posts (which doesn't require authentication afaik).
Now I get this:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
I haven't changed anything in my code, and I tested in two different browsers and two different machines with the same result. I don't think I've hit any limits (I'm using the API very seldom). I can't find any changes made to the API either.
Is anybody else having trouble with this? Can anybody point me to a lead?
Taken from the documentation on: https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed/
An access token is required to view publicly shared posts.
A user access token is required to retrieve posts visible to that person.
A page access token is required to retrieve any other posts.
Looks like you need an access token.
From today, in order to get posts from public pages through Facebook Graph, we always need to use Access Tokens.
New Permissions
An access token is required to view publicly shared posts.
A user access token is required to retrieve posts visible to that person.
A page access token is required to retrieve any other posts.
Old Permissions
An app or user access token is needed to view fields from fully public pages.
A user access token is needed to view fields from restricted pages that this person is able to view (such as those restrict to certain demographics like location or age, or those only viewable by Page admins).
A page access token can also be used to view those restricted fields.
Facebook is going through an entire change with their recent conflicts and allegations. They have stopped all API pulling for now and the access will be given again once all your Facebook Developer apps are reviewed by them.