iamabhaykmr
iamabhaykmr

Reputation: 2001

(#100) Missing permissions while access facebook ads data using marketing api using facebook-business sdk

I created a facebook app with the required permission below to read all of my campaign ads data.

enter image description here

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

Answers (0)

Related Questions