googleads / google-api-ads-ruby

Ad Manager SOAP API Client Libraries for Ruby
297 stars 227 forks source link

Accessing manager account and client accounts? #135

Closed RifathRashid closed 7 years ago

RifathRashid commented 7 years ago

Let's say you have a manager account, and that manager account is linked to multiple client accounts. If the manager account is authenticated, then how can you create an AdWords instance of each of the client accounts. Right now, I'm creating an AdWords instance of an account I have by passing in the ad_words_api.yml file. Instead of doing this, I want to create a manager account that will link to all of my accounts. I have code that gets the data from an account and stores it in a database. Ideally, after accessing the manager account through the API, I would loop through all the linked accounts and run my code on each of those accounts. Can someone explain how to do this> .

dklimkin commented 7 years ago

Hello RifathRashid,

You can initialize an API instance with a hash rather than from a file, see this wiki page for details:

https://github.com/googleads/google-api-ads-ruby/wiki/Configuration

If you are looking to retrieve data from all the accounts, take a look at our parallel report download example:

https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/examples/v201705/reporting/parallel_report_download.rb