I am having issues deleting a comment on my page via Facebook Graph API. My app has subscribed to all necessary permissions and the page token I have has all the necessary permissions for post moderation, including pages_manage_engagement and pages_read_engagement permissions indicated here https://developers.facebook.com/docs/graph-api/reference/comment/#deleting.
Ironically, I am able to delete some comments made by admins on my page but for others, I get the following exception:
{
"error": {
"message": "(#200) App does not have sufficient permission for this action",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AEb1bLEPhjgypCFBLr2FjiI"
}
}
When trying to get the comment from Facebook to check if It can be deleted, I get
{
"id": "xxxxxx",
"from": {
"name": "xxxx",
"id": "xxxxx"
},
"message": "some message to delete",
"is_hidden": false,
**"can_remove": true,**
"can_hide": false
}
Please what am I doing wrong?
Any help would be appreciated.
I am using the following endpoint
https://graph.facebook.com/v6.0/comment_id
with an Http delete request.
PS: v7.0 has the same result.
Related
I'm trying to use the Graph api to create pages. So I have an application type Entreprise, and a Test User. I tried this:
Post request to [userTest_id]/accounts/
Params:
{
"name": "Test Page One",
"about": "This is the first page created to check the api",
"cover_photo": {
"url": "https://i.etsystatic.com/6293506/r/il/ea9cf8/1809124703/il_fullxfull.1809124703_swn3.jpg"
},
"picture": "https://i.etsystatic.com/6293506/r/il/ea9cf8/1809124703/il_fullxfull.1809124703_swn3.jpg",
"category_list": "[\"174177802634376\"]"
}
I use user token
I get this error:
{
"error": {
"message": "Unsupported post request. Object with ID '[userTest_id]' 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": "ATSiLLBx2O1yOuPRFxq4r4V"
}
}
I've followed this doc:
https://developers.facebook.com/docs/graph-api/reference/user/accounts/#Creating
What I'm missing plz ?
Thanks.
Facebook API doesn't allow creating Pages in the "real world" scope. You may do it for test users (created on the Role tab) or, in production, you have to get special approval from Facebook (not just permission).
I can't get the official_events API to work in the Facebook API.
I made a Facebook app:
App type: Business
Not "Native or desktop app"
Latest API versions
I request an access token with the following permissions. (Probably more then needed but just trying)
public_profile email
pages_manage_posts
pages_manage_engagement
pages_manage_metadata
pages_manage_posts
pages_read_engagement
pages_read_user_content
pages_show_list
I login with myself or with the Facebook OpenGraph API test user.
I created a test page with both users.
I request the pages with access tokens with a call to the "me/accounts" endpoint.
With the page token I can create a message on the test page in the Graph API Explorer:
POST to <page_id>/feed
{
"message": "Hello world"
}
That works! So the page token is working.
Then I want to create an event on the page with the API described here:
https://developers.facebook.com/docs/pages/official-events/
Post to /official-events
{
"name": "test event",
"description": "some description",
"cover": {
"source": "https://testimages.org/img/testimages_screenshot.jpg",
"offset_x": "0",
"offset_y": "0"
},
"category": "FAMILY_EVENT",
"timezone": "US/Pacific",
"start_time": "2022-12-24 17:45:12"
}
But i receive this error:
{
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "AzueJBRnUjeqZh7vO0RxnG5"
}
}
Does anyone have any idea?
my app is in development
i am using below permissions:
"public_profile",
"publish_video",
"pages_show_list",
"pages_read_engagement",
"pages_manage_posts",
"publish_pages",
"user_managed_groups",
"groups_show_list",
"publish_to_groups",
"groups_access_member_info",
"publish_actions"
but on trying use the api to post photo in group and page i get below errors
https://graph.facebook.com/v12.0/{page-id}/photos?access_token=={token}&url={url.jpg}
error:
{
"error": {
"message": "(#200) The permission(s) publish_actions are not available. It has been deprecated. If you want to provide a way for your app users to share content to Facebook, we encourage you to use our Sharing products instead.",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AW4L8qJL7HJWz9oTL7rk1IY"
}
}
https://graph.facebook.com/v12.0/{group-id}/photos?access_token={token}&url={url.jpg}
error:
{
"error": {
"message": "(#200) Insufficient permission to post to group",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AsV2H45AICb6G7D73aiedW4"
}
}
Can someone please help with this
Solution for page post
follow this url for details: access_token
using user access token get page access token, pass this page access token in above url for page post
curl --location --request GET 'https://graph.facebook.com/v12.0/{page-id}?access_token={user-access-token}&fields=access_token'
We need to integrate with Facebook Marketing API for a simple workflow. A user should be able to login to the app with Facebook and allow us to post ads on their behalf.
It seems simple, however we are hitting a strange bug while creating an AdSet. While performing a correct call:
curl -i -X POST \
"https://graph.facebook.com/v8.0/act_XXX/adsets/?status=PAUSED&optimization_goal=REACH&daily_budget=10&name=Test%20Ad%20Set&campaign_id=XXX&targeting=%7B%22geo_locations%22%3A%7B%22countries%22%3A%5B%22US%22%5D%7D%7D&end_time=2015-03-12%2023%3A59%3A59-07%3A00&access_token=<access token sanitized>"
With token permissions:
{
"perms": [
"ads_management",
"ads_read",
"public_profile"
],
"user_id": XXX,
"app_id": XXX
}
and with POST payload:
{
"status": "PAUSED",
"optimization_goal": "REACH",
"daily_budget": "10",
"name": "Test Ad Set",
"campaign_id": "XXX",
"targeting": "{\"geo_locations\":{\"countries\":[\"US\"]}}",
"end_time": "2015-03-12 23:59:59-07:00"
}
We get a response reading:
{
"error": {
"message": "An unexpected error has occurred. Please retry your request later.",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "AUV0_CHdqPNtGuqNd-ZHCW6"
}
}
This seems like a bug on FB side, however, they seem have a track record of returning this message when something is wrong with a request or permissions. While we are waiting for their support response, I am wondering if something could be wrong on our side.
The app is pretty bare bone right now, and we are playing only with the Graph Explorer tokens. Should we go through some review process to get rid of the error? Posting ad campaigns works correctly, so this is even stranger.
I have 2 facebook pages where im admin on, lets call them page_a and page_b
if i run this for page_a it works as expected:
HTTP GET -> {PAGE_A_ID}/insights?metric=page_fans_country
{
"data": [
{
"name": "page_fans_country",
"period": "day",
"values": [
{
"value": {
"AR": 4,
"AT": 13,
"AU": 7,
"BE": 16,
....
the page access token i use have the following scopes: read_insights, manage_pages, pages_show_list and public_profile
but when i then try to query details about a post i get this
HTTP GET -> {PAGE_A_ID}_{PAGE_A_POSTID}/insights?metric=post_impressions,post_impressions_unique,post_video_views,post_video_views_unique&period=lifetime
{
"error": {
"message": "Permissions error",
"type": "OAuthException",
"code": 200,
"error_subcode": 1504029,
"is_transient": false,
"error_user_title": "User doesn't have enough permissions to load insights",
"error_user_msg": "You do not have enough permission to view the metric.",
"fbtrace_id": "..."
}
}
it works when i do the same for page_b
HTTP GET -> {PAGE_B_ID}_{PAGE_B_POSTID}/insights?metric=post_impressions,post_impressions_unique,post_video_views,post_video_views_unique&period=lifetime
{
"data": [
{
"name": "post_video_views",
"period": "lifetime",
"values": [
{
"value": 0
}
],
....
the page access token for page_b has same scopes as the one for page_a
I can see all the numbers in facebooks UI, but i cant not access it via the API, anybody had similar issues before?, im stuck and dont know where to go from here.
All above code have been ran in the Facebook Graph Explore, with newly generated tokens.
Any inputs on where to go from here are appreciated.
As mentioned in a comment by #xuantuan58 this seems to be a bug in the FB API.
https://developers.facebook.com/support/bugs/301627877187448/
And may also be related to this bug report: https://developers.facebook.com/support/bugs/2380273985356980/
I have noticed it is only occurring on certain users & pages but as of yet am unable to see a pattern. Sometimes an error will not be returned by the API and instead just an empty data array. If you think there should be data in the response try using the graph explorer tool as I've found that will sometimes give better error responses.
https://developers.facebook.com/tools/explorer/
UPDATE: This issue has now been marked as resolved by Facebook. I have been testing and found this issue has indeed been fixed.
We got the same issue a couples day ago. After playing with scopes we found that if business_management scope is grant then we got the data. But clearly, from its document business_management is not required for reading Page Insights. Hopefully, there is someone has better insights