How to change accounts dynamically in v201609 (PHP)

30 views
Skip to first unread message

ystm...@gmail.com

unread,
Feb 21, 2017, 9:37:55 AM2/21/17
to AdWords API Forum

We've been using v201605 for ad management tool and now updating it to v201609.

We have many clients, so need to change accounts dynamically for iterative tasks.


 AdwordsUser class supports this function in v201605.

<auth.ini>

---------------------------------------------------------------------------------------------------------------
clientCustomerId = "INSERT_CLIENT_CUSTOMER_ID_HERE"

; Uncomment clientCustomerId to make requests against a single AdWords account,
; such as when you run the examples.
; If you don't set it here, you can set the client customer ID dynamically:
;  $user = new AdWordsUser();
;  $user->SetClientCustomerId(...);

---------------------------------------------------------------------------------------------------------------


How can we accounts or clientCustomerIds dynamically in v201609 like v201605 or any other ways?


Thanks in advance!

Shwetha Vastrad (AdWords API Team)

unread,
Feb 21, 2017, 10:56:34 AM2/21/17
to AdWords API Forum
Hi,

You can set the clientCusotmerId dynamically while creating an AdWords session as shown below:

    $session = (new AdWordsSessionBuilder())
        ->fromFile()
        ->withOAuth2Credential($oAuth2Credential)
        ->withClientCustomerId(clientCustomerId)
        ->build();

Regards,
Shwetha, AdWords API Team.

ystm...@gmail.com

unread,
Mar 8, 2017, 9:42:37 AM3/8/17
to AdWords API Forum
Thank you! I solved it ^^


2017년 2월 22일 수요일 오전 12시 56분 34초 UTC+9, Shwetha Vastrad (AdWords API Team) 님의 말:
Reply all
Reply to author
Forward
0 new messages