none
Bing Ads API Reporting for Agency Account - How to Download from Specific Account or Accounts? RRS feed

  • Question

  • I am using the example code by Eric Urban.  When using this code on a non-Agency account, it works.  When I attempt to use it on an Agency account:

    1. I'm not sure what to use for the account_id - the Agency account or the account I'm trying to access within the Agency account?

    2. It returns blank report with headers and footers.

    Does a Bing Ads Agency account require special permission such as an 'Agency Token'?

    Lastly, is additional code needed to access 1 or multiple accounts within an Agency account to download into one report?

    Update/Edit:

    Since my question, I have found the SearchUserAccounts code and was able to see account and customer IDs.  And after looking at the ReportRequests.py further, I think this is why I'm getting blank reports - if it is looking at the first account in the Agency account.  Still any feedback or advice is welcome.  I know these questions are probably super-basic to most of you but I'm trying to leverage every tool (this forum being one tool) to understand this all as quickly as possible.

    # For this example we'll use the first account.
     authorization_data.account_id=accounts['Account'][0].Id
    authorization_data.customer_id=accounts['Account'][0].ParentCustomerId


    • Edited by jnscollier Tuesday, September 8, 2015 9:06 PM
    Tuesday, September 8, 2015 7:27 PM

Answers

  • If you have access to multiple accounts you can include multiple account IDs in the report request's Scope, for example you can modify the ReportRequests.py sample as follows.

    scope=reporting_service.factory.create('AccountThroughAdGroupReportScope') 
    scope.AccountIds={'long': [accountid1, accountid2, accountid3] } 
    scope.Campaigns=None 
    scope.AdGroups=None 
    report_request.Scope=scope 

    Set the header to any account ID that you can access. The current implementation of the sample uses the first account ID found.

    Regarding your questions about agencies, if you have permissions to an account via the Bing Ads web application, then you can also access the account via Bing Ads API. For more information, see Management Model for Agencies.

    Best regards,
    Eric

    Friday, September 11, 2015 1:45 PM
    Owner

All replies

  • If you have access to multiple accounts you can include multiple account IDs in the report request's Scope, for example you can modify the ReportRequests.py sample as follows.

    scope=reporting_service.factory.create('AccountThroughAdGroupReportScope') 
    scope.AccountIds={'long': [accountid1, accountid2, accountid3] } 
    scope.Campaigns=None 
    scope.AdGroups=None 
    report_request.Scope=scope 

    Set the header to any account ID that you can access. The current implementation of the sample uses the first account ID found.

    Regarding your questions about agencies, if you have permissions to an account via the Bing Ads web application, then you can also access the account via Bing Ads API. For more information, see Management Model for Agencies.

    Best regards,
    Eric

    Friday, September 11, 2015 1:45 PM
    Owner
  • Thanks very much Eric.  Your sample code on Github is a huge help.  After doing the work and spending the time really understanding your code examples, it made sense.  Thanks to your documentation, I was able to learn (high-level) the Bing Ads API much faster than the Adwords API.
    Sunday, September 13, 2015 9:13 PM
  • Glad to hear, thanks! If you have any further questions, please don't hesitate to ask.
    Sunday, September 13, 2015 9:19 PM
    Owner