Facebook Ads Insights API: (#3) Application does not have the capability to make this API call - facebook

I am trying to pull Facebook Ads metrics through the Facebook Marketing API. The flow is basically that I wish to pull all the account ids of my company, and then loop over them, retrieving the insights for them individually.
However I have an error which I am not able to solve/comprehend.
When I attempt to make the API call (both in the Graph Explorer and my Alteryx workflow):
GET-> /v2.8/act_<Account_ID>/insights
I get the following error:
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "BNevVWUExDg"
}
I must admit that I am quite at a loss what is causing this error...and actually also exactly what the issue is...am I lacking the right scope/permissions for my token?
With the same token I am able to correctly call the API to get a list of all adaccounts (GET-> /v2.8/me/adaccounts ).
Anyone have an idea what my issue might be?

You have to make sure that your particular access token has the permissions ads_management or ads_read.
This is from the Marketing API quickstart. https://developers.facebook.com/docs/marketing-apis
There are also rate limits on those API's, but I would expect a different error if that was the case.

I ran a POST instead of GET on the same endpoints, which gives me another error about not being admin on the account.
It appears that the user associated with the token (which is a long lived one) was only having analyst access to the account in Business Manager. After I changed it to advertiser it seems I can do the GET call.

In my case, I added a new development user in the roles page. Then I was trying to do OAuth. I got the error message "Application does not have the capability to make this API call."
Here's the way that I solve the problem while your application still in the development mode.
Go to Marketing API > Tools
Then select what token permissions you want. Press "Get Token" button.
Now, you can try to do OAuth again.

Related

Facebook Graph API Service Temporarily Unavailable Error

I am trying to connect a bot to Facebook messenger, using Facebook developer tools.
https://developers.facebook.com/
I've created the Facebook app, and it's sent me the webhook to my server. However, when trying to call the Graph API when sending a message back to the user, I receive the following error:
FacebookMessaging:400 : {
"error": {
"message": "(#2) Service temporarily unavailable",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "AIWsRyUmPFnySGwb1Rgl4P6"
}
}
POST API,
https://graph.facebook.com/v10.0/page-id/messages?access_token=token
JSON
{recipient:{id:"id"}, message:{ text:"message"}}
I suspect it could be because my app is unreleased, but I'm trying to test it beforehand. Is there any other explanation for this, or how are you suppose to test an app before releasing it?
The same code is working for an older Facebook app that is released.
The issue was that the API call was missing the access token. Stupid mistake, but unusual error for missing the access token.
I already try and reproduce this problem. May be you use wrong access_token in this case. When you want to send the message by page, use should use page access token instead of user access token
Check out the diff here: https://developers.facebook.com/docs/facebook-login/access-tokens/
And flow here for get page access token: https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens
It is clearly return you the response with type as OAuthException. If you find this error type in facebook garph api error handling documentation. You can see the first line of error codes is OAuthException. Also it is written there the resolution of this type of error in what to do column is, If no subcode is present, the login status or access token has expired, been revoked, or is otherwise invalid. Get a new access token.
If a subcode is present, see the subcode.
Well it is nice to see you get the answer on your own.

How to get overall star rating of Facebook page from Facebook Graph API?

I am trying to make a very simple request to Facebook's Graph API using this URL:
https://graph.facebook.com/v2.12/1984193321812400?fields=overall_star_rating&access_token=205658113371329|gYdP-nDHNVENlwVxria21Uczgs8
All I want from Facebook is the overall_star_rating of my Facebook page. However, this is what I get:
{
"error": {
"message": "(#200) Access to this data is temporarily disabled for non-active apps or apps that have not recently accessed this data due to changes we are making to the Facebook Platform. https://developers.facebook.com/status/issues/206742313468873/",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "A9XRfTkh3WR"
}
}
Since I am completely new to Facebook Graph API: Is the request I am making correct or am I missing something really fundamental here?
And yes, I read Facebook's issue report, but I don't find it very helpful since I set my app to active already and it's not working anyway.
Thanks for any help in this matter.
Since Facebook is undergoing major changes, they have revoked few access to non active apps. Get the access_token from any frequently used app, your Graph API call is pretty correct!
But the Page ID seems to be wrong, as it shows me error after adding a working token.
Error : "message": "(#803) Some of the aliases you requested do not
exist: 1984192327815400"
After changing the Page ID, and adding active app token, it shows the correct result.

Accessing Facebook Ads API request error 270

I have a whitelisted Facebook App that is out of sandbox mode and has been approved for the Ads API, but I am receiving the following error when trying to make requests to the Ads API.
{
"error": {
"message": "(#270) This Ads API request is not allowed for apps with only developer access",
"type": "OAuthException",
"code": 270
}
}
This occurs when using adgroupstats, adcampaignstats, and reportstats requests, etc. The adaccounts request does return my account information though. My dashboard does read "This app is public and available to all users", as I needed to get out of sandbox mode in order for my app to be whitelisted.
Is there another setting that I have missed in order to gain access to the Ads API calls that I need?
Answer:
This is most likely due to your dev/admin accounts of the app not being set as "Admins" in facebook's ad manager. Let me know if this solves this issue for you.
Old response:
I am running into the same issue. Can not run api calls against reportstats even though the user that the app/ad account belongs too was an admin, i change that user to a developer and its still happening.
I opened a bug report for this: https://developers.facebook.com/bugs/786289188058999

Facebook's ads api exception 294 - Managing advertisements requires the extended permission ads_management, and a participating API key

My campaign is running on FB and I want to extract daily data with the help of Ads API.
I'm using facebook ads api and I'm facing this problem every time
{
"error": {
"message": "(#294) Managing advertisements requires the extended permission ads_management, and a participating API key",
"type": "OAuthException",
"code": 294
}
}
I have created one app XYZ and using this created I created an ad campaign.
With Graph API Explorer I generated Access Token. and I give permissions also.
You have to make sure you have an application white listed to use the Ads API. Also, you need to make sure you get an access token for that white listed application. If your app is white listed, you can use the graph explorer, change the drop down to your app, click get access token and make sure you tick the ads_management permissions. Hope that helps.
You must have to extended permission for accessing facebook ads using api.
In your facebook application which one you created in facebook account .Add itme in status and review for ads_managemnt, insight.
Setting -> Status & Review -> Items in Review.
There are few way how to generate app access tokens in FB. If you want to access marketing api you should do this in page https://developers.facebook.com/apps/{YOUR_APP_ID}/marketing-api/tools/ using required options.

How to Get feed of public Facebook page using Graph api?

There are already several questions on StackOverflow ( Can you get a public Facebook page's feed using Graph API without asking a user to allow? Get public page statuses using Facebook Graph API without Access Token? )concerning my question: I need to get through the graph API the feeds of a public page on facebook.
I followed the instructions but I always get:
{"Error": {"message": "An access token is required to request this resource.", "Type": "OAuthException", "code": 104}}
how can I fix this? I'm going crazy because everyone seems to work except me! thanks
Based on your description, the error is that you weren't supplying a valid access token with your request.
If the app's type is set to 'Native / Desktop' it's assumed you distributed the app's secret key with the binary, and thus the app access token isn't trusted (and 'getAccessToken' in the PHP SDK will only work when real users log in, it can't fall back to the app token)
If you were attempting to use the app access token to read the page's feed, this would fail in the manner you described.