Reputation: 2001
I created a facebook app with the required permission below to read all of my campaign ads data.
Section of code:
def get_facebook_campaign_data(app_id,app_secret,access_token,account_id,s_date,e_date):
# try:
FacebookAdsApi.init(app_id, app_secret, access_token)
account = AdAccount("act_"+account_id)
print(account)
# res = account.remote_read(fields=[
# AdAccount.Field.name,
# ])
# print(res)
# Print out account name.
campaigns = account.get_campaigns(fields=['id','name','account_id'])
print("Total number of Campaigns :",len(campaigns))
While calling the get_compaign method it gives the permission error below even I have attached required permission as shown in the screenshot.
facebook_business.exceptions.FacebookRequestError:
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v17.0/act_1107996893942456/campaigns
Params: {'fields': 'id,name,account_id', 'summary': 'true'}
Status: 400
Response:
{
"error": {
"message": "(#100) Missing permissions",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AN_NKUR8AkpLLm1kKxzibJI"
}
}
Can anyone help me with this? Any leads are highly appreciated! Thanks.
Upvotes: 2
Views: 530