I am trying to follow an example on Reach Estimate in facebook API documentation here. However I am getting an error:
{
"error": {
"message": "(#10) You do not have sufficient permissions to perform this action",
"type": "OAuthException",
"code": 10
}
}
My approach is to open https://developers.facebook.com/tools/explorer, generate a token giving all permissions including ads_management.
And perform call:
act_ID/reachestimate?currency=EUR&targeting_spec={'countries':['US']}
Where I obtain ad account ID by going to my ads manager and reading it off URL (or by visiting power editor).
It looks simple, but I have no idea at this point what I am missing, I am also getting the same error while using PHP API.
All ideas are much appreciated. Thank you.
If you are using your own app to generate the access token, you are likely on the Standard or Basic tier of the Marketing API. For these tiers, you need to specify each AdAccount you are going to use.
In the developer too, select your app and go to Apps > Settings > Advanced. Under "Advertising Accounts" click the "Ads API" button on the right hand side, and list all the accounts you want to use.
For more info, see:
https://developers.facebook.com/docs/marketing-api/access#standard_accounts
Related
I'm trying to use this endpoint from the Instagram graph api:
GET /ig_hashtag_search?user_id={user-id}&q={q}
Documentation for this endpoint can be found here.
I'm running this GET request:
https://graph.facebook.com/v14.0/ig_hashtag_search?q=coke&transport=cors&user_id=<my_user_id>&access_token=<my_access_token>&q=coke
and get this as response:
{
"error": {
"message": "(#200) Requires instagram_basic permission to manage the object",
"type": "OAuthException",
"code": 200,
}
}.
The user id comes from my instagram account and the access_token that I'm using is a User token generated with "Graph API explorer" and I can see that this token has the scope "instagram_basic" when using the "Access Token Debugger".
I can't understand why this does not work? Do I really need to submit a API review just to test the hashtag endpoint during development?
Please help!
I guess sometimes App review team of Facebook doesn't know what is the usage of the permission so they just decline the submissions randomly. I got that permission like 3 months ago and i checked my app review. I send them this text
We are going to use instagram_basic to read an Instagram account profile's info and media. We will get the basic metadata of an Instagram Business account profile like "USERNAME", "ID", "FOLLOWERS", "FOLLOWING". You can check the Screescast to see how we use the instagram_basic on our app.
Here is what they saw while they do the app review
Also be careful while you send requests, keep in mind to change it to development mode. Some of the endpoints works only in live mode. The API still changes a lot and there are tons of bugs i see in my project. I hope this helps.
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).
Does anybody know what does it mean error_subcode: 33 in the facebook response error? I know it's related to a mission permission but I want to be 100% sure.
We received the following error:
{"error":{"message":"Unsupported get request. Object with ID 'XXXX'
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":"BRwGjA9kkKU"}}
But in the Facebook API documentation about Graph API https://developers.facebook.com/docs/graph-api/using-graph-api/ , I cannot find error_subcode with value 33.
I want that I can rely on this subcode to verify that I don't have permissions to get the resource from Facebook API because I don't want to rely on the error message.
Here is the Facebook bug portal link to the similar issue:
https://developers.facebook.com/bugs/316526372199563/
The gist of it is:
these users registered for Facebook/Messenger using their phone number and such users are not yet queryable by the API. This is on the roadmap for the API, please keep an eye on our changelog for when this goes live in a future version: https://developers.facebook.com/docs/graph-api/changelog"
I can't offer a definitive solution, as there seem to be multiple possible causes. However, I encountered this today and wish to offer this possible cause.
If you are encountering this error when you are testing your Facebook TEST app, it might be related to the fact that you're in TEST app mode.
In my case, I worked on implementing Facebook login for a while. When my partner joined in development, he couldn't log in in his development environment. He got the error you mention for the 'me' endpoint:
{
"error": {
"message": "Unsupported get request. Object with ID 'me' 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": "____"
}
}
This had actually already been deployed and tested to our production environment, where we are both able to register and log in just fine.
After I added him as Administrator to the Facebook TEST app, the issue resolved and he could register and log in on his own development environment.
So, you may want to check if this is applicable to you. An easy way to check is to use the keys for the real app in your development environment.
Error subcode 33 information as per Facebook official documentation:
Error code 100, subcode 33
Unsupported post request.
This error may occur if your access token is not added as a system user with appropriate permissions to the ad account that owns a Custom Audience. Verify the ad account in Business Manager and verify all system users appear under the ad account as Admin:
Click on Business Settings
Click the ad account
Select Add people
Search for system user and add them as Admins
Retry your API call
Here's the link to the Facebook marketing API error reference.
https://developers.facebook.com/docs/marketing-api/error-reference/
This contains the resolution for error 33 along with all the other errors.
I'm trying to build an application that will help manage different ad accounts for different customers (multiple businesses, so it has to handle multiple ad accounts). I'm looking at the ads API documentation for ad account groups, and the examples aren't working in the graph API explorer. Things like GET requests to
https://graph.facebook.com/v2.4/<AD_ACCOUNT_GROUP_ID>/users
(from Facebook's documentation here) are returning the following error:
{
"error": {
"message": "(#275) Ad account cannot be determined for this request",
"type": "OAuthException",
"code": 275
}
}
As best as I can tell, the documentation is incorrect - I think it can't tell the difference between an ad account ID and an ad group ID (I know this pattern is also used for things like managing custom audiences which is why I'm guessing it thinks it should be seeing an add account ID). Is there a better guide on updating ad account group membership via the API I can reference, or an endpoint I can substitute in for Facebook's official documentation?
First off please note at this time, you can still use v2.3 Facebook graph calls, prior versions have been deprecated by Facebook.
You will get this error. If you try older graph versions:
{
"error": {
"message": "(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version.",
"type": "OAuthException",
"code": 2635
}
}
At the time of this writing you can use v2.3 calls and it still works.
Next I presume you want to know all the users, within accounts so the first thing to do is to get the list of accounts... Then iterate through each.. on an ad account basis.
Look up the api call to get a list of ad accounts, for a Facebook user id.
You will need the ad_read permission on the token in order to get the list.
Your api call should then look like this to get the users on each account.
Notice I put act_ in front of the actual account id. This is required and tells Facebook you are dealing with an ad account.
https://graph.facebook.com/v2.3/act_999998730499999/users?access_token=CAZZZZZpCZBjEBAJmcyfqbcluGAJZCtqfv4kI6CtLC7JGHaJ7IO2ImGCfkQFZC9NXCAZC2CAbtEdQcWMYFpqsFAkgJVqNqjnKGQkMrukyl53WZBIdq7vofFYyxvaTJTsWVOQhWTrjNoox0QqRCt3vGaDsRGHLBFDxqKLfXOcDKfS1oppj1nDjKdPe2GHYrHirlBkhxWS95MNgW7ajZZZZZ
Note: I have added ZZZZZs and 9999s in places to disguise my actual account and token.
The token used must be the ad account holder's token for the app. The user must have authorized the app for the ad_read permission on this token creation for the call to work.
The result looks like this:
{
"data": [
{
"name": "Joe Programmer",
"permissions": [
1,
2,
3,
4,
5,
7
],
"role": 1001,
"id": "999995304499999"
}
]
}
When using the development access of the Facebook Ads API, you need to specify which adaccounts you are going to use and you must own the adaccounts.
See the following guide:
https://developers.facebook.com/docs/reference/ads-api/access#standard_accounts
I'm having an issue getting the graph search to work when I manually use the Graph API Explorer to generate an access token for myself against my application.
I've created an application, set the sandboxed mode to 'off', and then manually granted my user account permissions to my application. To be safe, I included all the permissions available in the graph API explorer before generating the access token.
When I click on my access token, I see that it is still valid, and has all the permissions listed, however, when I perform the following search:
/search?q=myphonenumber&type=user
I get an error saying:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}
}
I know the above search code is valid because I was able to get it working a few days ago, I can't seem to figure out what has changed. Am I missing a permission somewhere that prevents me from using my access token to do an API search?
UPDATE: I should also mention that normal /me queries work just fine, it seems to be only the search which is disallowed.
I got the same problem when searching for email addresses using the same search term. While researching the problem, I found this bug report: https://developers.facebook.com/bugs/453298034751100?browse=search_516534c213df06064266897. So Facebook is aware of the problem but nothing has changed for more than a week now.