Context:
I have a facebook page with a post
I want to hide that post from anyone accessing the page (other than me) using the Facebook API
This can be achieved using the privacy field with "SELF"
Problem: Before I can even use it in my application, I cannot get a working example in the Graph API Explorer. I am using:
POST /v2.7/POST_ID?privacy={"value":"SELF"}
This works with other properties such as message, but despite many attempts, when I am able to actually set the privacy value property I always get the following message:
{
"error": {
"message": "(#100) Failed to edit object",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "DkL5f4bzK2E"
}
}
Question: Can anyone provide a working example?
References:
Graph Explorer: https://developers.facebook.com/tools/explorer
Privacy Parameter: https://developers.facebook.com/docs/graph-api/common-scenarios#privacy-param
After asking Facebook Support Team if it was a bug, it is not, their answer:
You cannot edit the privacy of a post on a page . You can choose to
publish / unpublish it , if needed.
To change the audience of the page itself, you will need to edit the
settings of the page.
This is by design.
You can also see their answer directly: https://developers.facebook.com/bugs/152272141874454
Related
I am trying to extract instagram insights data to further analyze it locally and store it. For that I generated a system user access_token with the required permissions. Now I am trying to perform a GET request just as described in this documentation: https://developers.facebook.com/docs/instagram-api/reference/ig-user/insights
For that my call URL looks like this:
https://graph.facebook.com/v15.0/{instagram-id}/insights?metric=impressions,reach,profile_views&period=day&access_token={system_user_token}
This gives following response:
{
"error": {
"message": "(#100) The value must be a valid insights metric",
"type": "OAuthException",
"code": 100,
"fbtrace_id": xxx }
}
Thinking maybe this is due to my system user token not beeing elegible for this call I tried the Graph API explorer in the browser and a generated access token with the needed permissions. I am not quite sure where to go from here. Thank you for your help
I tried different access_tokens generated in the business manager and also generated in the meta for developers website. I tried to use a variety of different metrics described in the documentation. All gave the same output as described above. I also tried different api versions (15.0 and 16.0)
I have an element on my website which shows facebook posts from a page and the amount of views/likes/comments. This stopped working all of a sudden and I have no idea why.
If I make the request with the graph api tester tool I get:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "CIHVxFhXIv/"
}
}
This is the request link I use with file_get_contents:
https://graph.facebook.com/v3.0/idofmypage/posts?fields=comments,full_picture,likes,message,picture,story,permalink_url,updated_time,from,insights.metric(post_impressions)&access_token=myaccesstoken
Did something change again with permissions or maybe a field is deprecated?
According to this fb new the Pages API and others have changed, and now you can only access the data if it's a page of your own.
Pages API: Until today, any app could use the Pages API to read posts or comments from any Page. This let developers create tools for Page owners to help them do things like schedule posts and reply to comments or messages. But it also let apps access more data than necessary. We want to make sure Page information is only available to apps providing useful services to our community. So starting today, all future access to the Pages API will need to be approved by Facebook.
Today I've started a project wich, in the begging, I need to recollect data and that's what I've found about it..
I am testing the facebook graph API comments
https://developers.facebook.com/docs/graph-api/reference/v2.12/object/comments
I checked my permission for the access token it contains the permission, which required by API. see the screenshot
I test my object-id (1797963943566411_1975256375837166) which is correct see me screenshot
Change the request method to POST and adding post data {"message": "haha"}
I get the error message shows:
"(#3) Publishing comments through the API is only available for page access tokens" see my screenshot
As you can see the first step checking, I have all the permission that the
API required.
Can any one see any sort of error in this process?
Try another way still not work.
I have a user who post a photo on his own facebook page.
I logged in with this user and give this user all permissions see the screenshot
enter image description here
call /me/accounts to get page access token
enter image description here
copy the page access token into the Graph API Explorer's access token field
call
GET: 1797963943566411_1975256375837166/likes
is working fine
But call POST: 1797963943566411_1975256375837166/likes
Get error response:
{
"error": {
"message": "(#200) Permissions error",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "GtEaBfyXrUD"
}
}
The reason is Facebook changed the API behaviour. We are no longer to use api to like any POST on our time line. API can only like or comments on facebook page. Sad face !!!!
Facebook's Graph API documentation lists the application object's ios_bundle_id field under the "Updating" section. However, sending a POST request to update said field, e.g.
POST: https://graph.facebook.com/v2.3/{application_id}?ios_bundle_id=["com.Company.AppName"]&access_token={app_access_token}
Responds with this error message:
{
"error": {
"message": "(#100) ios_bundle_id cannot be edited using the API. Please use the Developer App to edit settings instead.",
"type": "OAuthException",
"code": 100
}
}
I am able to update this field through the Developer App page, but in my case, I need to update this field programmatically.
I have successfully tested that same POST request to update other fields, e.g. app_name, so I am certain the request is structured properly.
Has anyone encountered this issue, or similar? Any suggestions are appreciated.
This is a documentation error. This field is not editable via the Graph API. You have to go into your Facebook Application Dashboard and change it from there.
Here's a link to the bug report created to fix this:
https://developers.facebook.com/bugs/1646835812217089/
I am trying to fetch a Facebook page's events. I have before, but it doesnt work any more. I used this scriptto fetch the events.
$string = file_get_contents("https://graph.facebook.com/?$pageids&fields=events.limit($fblimit)&access_token=$token&method=GET");
$json_a=json_decode($string,true);
$pageids was a lot of different facebook ids (id1,id2,id2 ...)
I get this error message:
{
"error": {
"message": "(#100) Unknown fields: events.",
"type": "OAuthException",
"code": 100
}
}
Does anyone know what is wrong with my script? Is there a another way to fetch Facebook events?
The actual URL to get a page's events is something like this :
https://graph.facebook.com/PAGE_ID/events
I'm not sure how old the code is that you are fixing, but this is the correct method as stated in the documentation. events is a connection of the page object.
Reference: https://developers.facebook.com/docs/reference/api/page/#connections
Facebook has had restricted access of Events in API recently.
You have to do app review to have access to Pages API, Events API.
Please check section "Apps that Require App Review, Business Verification, and Supplemental Terms" of this url: https://developers.facebook.com/docs/apps/review