Facebook Ads API Error - Not enabled for usage

折月煮酒 提交于 2020-01-11 04:54:09

问题


So I have been trying to create an app that uses the Facebook Ads API to get ad costs and stats. I have created an app and added my ad account ids to the app settings but still get the error:

"error":{"message":"(#274) The ad account is not enabled for usage in Ads API. Please add it in developer.facebook.com -> application -> settings -> advanced -> advertising accounts -> Ads API. Account XXXXXXXXXXXXX not enabled for application XXXXXXXXXXXXX.","type":"OAuthException","code":274}}

Any idear why it would still be giving me this error? Or how I can get through this step.


回答1:


When using the Ads API in development mode, you need to specify the AdAccounts you are going to use in the developer console.

See the following guide for more details: https://developers.facebook.com/docs/reference/ads-api/access#standard_accounts




回答2:


Let me give you the workaround that helped for me . You have to go your app and in the added products tab on the left side panel click on Marketing API , click on tools, on the right side, select the permissions needed and get the token. Now use this token and pass it with the FB.api('POST'.. call along with the other parameters. You won't get the error anymore and if you check your advert you will have a new campaign or Adset whichever you are trying to create.




回答3:


I was getting this #274 error and it started working after adding the Test Sandbox Ad Account's ID (under Marketing API > Tools) to the Ads API Account Configuration (under Settings > Advanced > Advertising Accounts). Prior to adding the Test Sandbox Ad Account's ID, I had only added my production Ad Account's ID, which didn't work for some reason.

Also when I was making test Graph API calls using Graph API Explorer, there's the Application select box in the top right. For some reason it was defaulting to "Graph API Explorer" instead of the name of my application. Whenever I selected the name of my application and generated a new user access token, I was able to make requests similar to the following:

//Get the Ad name associated with an AD_ID
https://graph.facebook.com/<API_VERSION>/<AD_ID>?fields=adset_id,campaign_id,name,account_id

//Get the Adset name associated with an ADSET_ID
https://graph.facebook.com/<API_VERSION>/<ADSET_ID>?fields=account_id,name

//Get the Campaign name associated with a CAMPAIGN_ID
https://graph.facebook.com/<API_VERSION>/<CAMPAIGN_ID>?fields=account_id,name


来源:https://stackoverflow.com/questions/26985300/facebook-ads-api-error-not-enabled-for-usage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!