"message": "Unsupported post request. Object with ID does not exist, cannot be loaded due to missing permissions - facebook

I have two apps on facebook. In one, I can make API calls. In the other, I can not.
I checked the configuration and the settings are the same.
Can you help me?
Example: https://graph.facebook.com/860599774051206/?access_token=APP_ID|APP_SECRET
https://graph.facebook.com/860599774051206/notifications?template=#[860599774051206]test&access_token=APP_ID|APP_SECRET&method=post
the error is:
{ "error": { "message": "Unsupported post request. Object with ID
'860599774051206' does not exist, cannot be loaded due to missing
permissions, or does not support this operation. Please read the Graph
API documentation at developers.facebook.com/docs/graph-api",
"type": "GraphMethodException", "code": 100, "fbtrace_id":
"BRW7BqFeEER" } }

RESOLVED:
Any app can change the user_id
In an app the user_id is 962084030569446, in the other 860599774051206
Thakns for all.

I faced this issue when I was trying to post a response to an user from a page. I used the graph API me/accounts and got the list of pages. From there I retrieved the access_token of the page from which I'm going to post the response. I got the same error mentioned in the question.
The issue for me is the user account to which I was supposed to respond is locked due to security. This is the error I got from facebook when I tried to login
You can't use Facebook at the moment
This is the error I got for the post api call
{
"error": {
"message": "Unsupported post request. Object with ID 'xxx' 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": "yyy"
}
}
Once the account security is resolved, the issue is resolved.

While unrelated to the OP problem I thought I would contribute, I got this error when posting to the Offline Events endpoint https://graph.facebook.com/v2.8/<business_id>/events. I had posted from a node.js app successfully, then when porting the approach to a .Net implementation in our Linnworks order management system, got this error.
Turned out, I had mis-typed the access_token parameter that goes in the form data, i.e.
System.Collections.Specialized.NameValueCollection formFields = new System.Collections.Specialized.NameValueCollection();
formFields.Add("accessToken", accessToken);
formFields.Add("upload_tag", "store_data");
formFields.Add("data", data);
Should have been:
System.Collections.Specialized.NameValueCollection formFields = new System.Collections.Specialized.NameValueCollection();
formFields.Add("access_token", accessToken);
formFields.Add("upload_tag", "store_data");
formFields.Add("data", data);
Getting the access_token field wrong in this way caused this 'Object with ID does not exist' which is a bit of a red herring. I guess that, once the access_token value was not provided, no objects could be enumerated in our account because the request didn't authenticate in order to provide permissions, and so the object was 'not found'
(you do not have to use NameValueCollection, this is just a by-product of me using the multipart post implementation suggested here Upload files with HTTPWebrequest (multipart/form-data))

In my case - I had to use the app-id to get the list of pages using me/accounts.
Once I identify the page that I want to post the message to, I have to use the page-id to feed page-id/feed.
This solved the issue.
For example:
$response = $fb->get('/me/accounts', (string)$selBehRow1["fb_app_access_token"]);
foreach ($response->getDecodedBody() as $allPages)
{
foreach ($allPages as $page )
{
if (isset($page['id']) && $page['id'] == $selBehRow1['fb_page_id'])
{ // Suppose you save it as this variable
$appAccessToken = (string) $page['access_token'];
break;
}
}
}
$response = $fb->post(
//this is wrong: '/'.$selBehRow1["fb_app_id"].'/feed',
'/'.$selBehRow1["fb_page_id"].'/feed',
array(
"message" => "$msg",
"link" => "$link",
//"picture" => "http://www.example.net/images/example.png",
"name" => "$name",
"caption" => "$caption",
"description" => "$description"
),
$appAccessToken
);
}

i think post_id is wrong you can check it once
https://graph.facebook.com/860599774051206_4548643168486465/?access_token=APP_ID|APP_SECRET
https://developers.facebook.com/docs/graph-api/reference/v3.3/object/comments
use this api for replies to the post
Method: POST
https://graph.facebook.com/860599774051206_4548643168486465/comments?access_token=APP_ID|APP_SECRET
body:
{
"message": "Thanks"
}

You need to use GET request instead POST. Look at the documentation

In my case I needed to Complete Setup

Related

GET request to Patch Management API (Patch Manager Plus - Cloud)

I followed the instructions in the Patch Manager Plus - Cloud (https://www.manageengine.com/patch-management/api/) . And then get information (like refresh_token, client_id, client_secret), get access_token for every hour.
When trying to initiate a GET request to api/1.3/som/computers, I get the following response back.
{
"message_response": "Unable to retrieve details, Please try again later.",
"error_code": 90004,
"error": "invalid input found",
"message_version": "1.0",
"status": "error"
}
My code is as follows:
axios.get('https://patch.manageengine.com/api/1.3/som/computers', {
headers: {
"Authorization": << access_token >>
}
})
I think there is a problem with the header such as missing some parameters. (I tried running the api in the browser (logged in) and got the data). I also searched but couldn't find a description for this part.
Can anybody help me, please?

Facebook Marketing API returns error on "breakdowns call"

I'm trying to make an API call with the folowing URL
act_XXXXXXXX/insights?fields=ad_id,clicks,unique_clicks,impressions,reach,spend,date_start,date_stop,actions,action_values,unique_actions,account_id&level=ad&breakdowns=platform_position&time_range={"since":"2019-09-07","until":"2019-09-07"}
and the response is :
{
"error": {
"message": "(#100) Current combination of data breakdown columns (action_type, platform_position) is invalid ",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "XXXXXXXXXXXXXXXXXXXX"
}
}
the reason is in "breakdown" value = "platform_position"
but the problem is that I need exactly that breakdown :(
when I do an API call and change "breakdown" in URL to something else, for example to "publisher_platform":
act_XXXXXXX/insights?fields=ad_id,clicks,unique_clicks,impressions,reach,spend,date_start,date_stop,actions,action_values,unique_actions,account_id&level=ad&breakdowns=publisher_platform&time_range={"since":"2019-09-07","until":"2019-09-07"}
it is OK and responds with data.
I don't know why it happens because I'm not specifying any "action_type" breakdown but it tells that I am :(
What I've tried:
I tried to remove all the parameters from that URL one by one but it still returns an error
The main questions are: why the API call for "breakdown" value = "platform_position" fails and how to make it work.
Thanks.
PS: you can use FB API testing tool to test requests to FB api.
I'm using API version v8.0
You will need both publisher and position:
breakdowns=publisher_platform,platform_position

Request Sync always returns 404 : "Error: Requested entity was not found."

I'm having a hard time implementing requestSync. It always returns
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
I use Node.js/Express for the backend. The linking/unlinking with the Google Home app work and my actions work as well. It's really the requestSync part that fails.
The closest ticket I've found, though not exactly the same, is this one.
Things I've tried
agentUserId is a string, but if I pass it a number it returns a 400 with the message "Invalid value at 'agent_user_id'".
tried sending agent_user_id instead of agentUserId, this returns a 404 the same error as when I send a agentUserId
tried removing the "async:true" part of the body. did not notice a difference.
during SYNC, hardcoded the value of the agentUserId to eliminate possibility that I'm sending the wrong one. I use that same agentUserId during requestSync and this fails.
tried linking/unlinking multiple times in the google home app
another interesting thing to note : when opening up the "Test Suite" from the actions on google console, I put in that same agentUserId + service account key, and it registers it well : I'm able to see my devices listed correctly. Which leads me to believe that my agentUserId is correct (this may be a false assumption)
I'm 100% sure HomeGraph is enabled as I can see data on the charts in the "Overview" section of the HomeGraph API part of the console.
This is what the curl looks like (same as from the example)
curl -i -s -X POST -H "Content-Type: application/json" -d "{agent_us
er_id: \"1\"}" "https://homegraph.googleapis.com/v1/devices:requestSyn
c?key=API_KEY"
(my agentUserId is 1 in this case)
And this is what it looks like in code :
const res = await fetch(
`https://homegraph.googleapis.com/v1/devices:requestSync?key=${config.googleApiKey}`,
{
method: 'POST',
body: JSON.stringify({
agentUserId: String(userId),
async: true,
}),
headers: { 'Content-Type': 'application/json' },
},
);
Regardless of what I do, the result is always :
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
I don't know where else to look to identify this problem. Any pointers would help. Thank you
Finally found the answer.
It wasn't too far from the one I had posted above. Although my problem is that when I generated an API key, the google home cloud console opened the wrong project by default. I had the wrong API key all along.

Facebook's Batch Request not picking up a JSON parameter

My goal is to create a number of ads using Facebook's Batch API : https://developers.facebook.com/docs/marketing-api/asyncrequests/v2.9
I am sending a POST request at this URL:
https://graph.facebook.com/v2.9/act_158365238/ads
I am sending 2 parameters as per the documentation:
1- access_token
2- batch
The JSON in the batch parameter looks like :
{
"method": "POST",
"relative_url": "v2.9\/act_158365238\/ads",
"attached_files": "test1",
"body": "creative={\"title\":\"Test title 1\",\"body\":\"Test body 1\",\"object_url\":\"https:\/\/apps.facebook.com\/testapp\/\", \"image_file\":\"test1.jpg\"}&targeting={\"countries\":[\"US\"]}&name=test1"
}
The Problem
When I send this request with POSTman or my PHP code, it throws the following error
{
"error": {
"message": "(#100) The parameter creative is required",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Gj2sG7N8l1f"
}
}
However when I send the exact same request via Facebook's Graph API tool, it successfully creates the ads.
According to the API Documentation provided to create creatives you should be posting to the URL "v2.9/act_187687683/adcreatives"... The fragment of the batch that you are showing is used to create an Ad.
If, as you say, your intention is to create an AdCreative then you should be using something like the above, which differs in the body from what you are using:
{
"method": "POST",
"name": "create_creative",
"relative_url": "v2.9/act_187687683/adcreatives",
"attached_files": "test1",
"body": "title=Test title&body=Test body&link_url=http://www.test12345.com&image_file=test1.jpg"
}
In the other hand, if what you are creating is an add, then you should consider referencing the AdCreative by its ID as is done in the examples, hence in the case of a creative added in the same batch you could use the relative reference to the name:
creative={\"creative_id\":\"{result=create_creative:$.id}\"}
or if it is a creative already created you can reference it by the creative_id:
creative={\"creative_id\":\"123456\"}
I think the message is a red herring -- it's not seeing your body's creative field because the OAuth isn't properly set in your POSTman requests, so it isn't parsing the body or seeing the creative field.
If you don't know how to set OAuth in POSTman, here's a good tutorial:
https://docs.brightcove.com/en/video-cloud/concepts/postman/postman.html

FQL query is not working

I have a Facebook application which was working a year before (version 1.0 of the API). Now I am trying to make it work again but it seems the FQL query is not getting any data.
For instance I have this simple query:
try{
$mailbox_email_num = $facebook->api(
array(
'method'=>'fql.query',
'query'=>"SELECT total_count,unread_count FROM mailbox_folder WHERE viewer_id = xxxxx"
)
);
} catch (FacebookApiException $e){
print_r ($e);
}
It works well through the online FQL editor and also before the updates of the API.
Now, I get an error code 606 -- "Wrong number of arguments passed into the function"(http://www.fb-developers.info/tech/fb_dev/faq/general/gen_10.html) while I am running the application.
Does anyone know why and how it can be solved?
Do I need to mention somewhere the version of the API that I want to use?
There are many errors that Facebook placed under the 606 code. This particular one is most likely
{
"error": {
"message": "(#606) You can only fetch messages for one user",
"type": "OAuthException",
"code": 606
}
}
You are probably using an id in the viewer_id column for which you don't have access for.