Hi,

On all services except CustomerService 
<https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService>,
 
you must specify which account you want each API request to act upon by 
setting the clientCustomerId 
<https://developers.google.com/adwords/api/docs/guides/soap#clientCustomerId> 
SOAP header. On CustomerService 
<https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService>,
 
that header is optional (see below).

To get the list of all accounts under an MCC you can use 
ManagedCustomerService 
<https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService>.
 
The .NET client library's GetAccountHierarchy.cs 
<https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201409/AccountManagement/GetAccountHierarchy.cs>
 
contains an example of how to do this.

To determine the type of customer, simply set the *clientCustomerId* header 
on a CustomerService.get 
<https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService#get>
 
request, and then check the canManageClients 
<https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService.Customer#canManageClients>
 
field, which will be *true* for an MCC, and *false* for a regular AdWords 
account. Note that if you do not specify *clientCustomerId* on a 
*CustomerService* call, it will simply return a *Customer* object that 
reflects the MCC or AdWords account associated with the request's OAuth 
credentials.

Cheers,
Josh, AdWords API Team

On Monday, December 22, 2014 9:21:54 AM UTC-5, Richard Moran wrote:
>
> Brilliant, I've managed to get all that working so far. The problem I'm 
> having now though comes when the logged-in user is an MCC user. In that 
> instance, the customer I want to add the campaign to is not their MCC 
> customer, it's one of their "account" customers. How do I get a list of all 
> their "account" customers? I can't see any "account" services. Also, how 
> can I tell if the logged in user is an MCC customer or just a standard 
> AdWords customer?
>
> On Friday, 19 December 2014 18:06:38 UTC, Josh Radcliff (AdWords API Team) 
> wrote:
>>
>> Hi,
>>
>> You may want to go through our entire OAuth guide 
>> <https://developers.google.com/adwords/api/docs/guides/authentication> for 
>> more details, but the OAuth scope for the AdWords API is documented in this 
>> section 
>> <https://developers.google.com/adwords/api/docs/guides/authentication#scope>
>> .
>>
>> Once you have a user's OAuth credentials for that scope, you can use 
>> CustomerService.get 
>> <https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService#get>
>>  
>> and grab the customerId 
>> <https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService.Customer#customerId>
>>  from 
>> the returned Customer 
>> <https://developers.google.com/adwords/api/docs/reference/v201409/CustomerService.Customer>
>>  object. 
>> You can then use that *customerId* to set the clientCustomerId SOAP 
>> header 
>> <https://developers.google.com/adwords/api/docs/guides/soap#clientCustomerId>
>>  in 
>> your API requests.
>>
>> Cheers,
>> Josh, AdWords API Team
>>
>> On Friday, December 19, 2014 12:10:44 PM UTC-5, Richard Moran wrote:
>>>
>>> I'm trying to follow this example of implementing OAuth (
>>> https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web_applications)
>>>  
>>> and I can successfully perform a log in and get access to the various user 
>>> properties using the "https://www.googleapis.com/auth/plus.login"; 
>>> scope. What scope do I need to use in order to be able to get a list of the 
>>> logged in user's AdWords client accounts and then post campaigns/AdGroups 
>>> etc on their behalf? I've found some references to "
>>> https://adwords.google.com/api/adwords/"; but that URL returns a 404. 
>>> Similarly, the OAuth playground (
>>> https://developers.google.com/oauthplayground/) doesn't have any 
>>> references to AdWords.
>>>
>>> Assuming there is a scope, what would it be? If there isn't a scope, how 
>>> do I get all the information and permissions I require? I don't want to use 
>>> an MCC as this adds too many steps and too much admin, I just want to be 
>>> able to get the information from the logged in user and post on their 
>>> behalf.
>>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/8549328b-003d-4062-96c3-db5fcef373b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to