Accessing API - can't figure out what account ID to use - dotnet client library

101 views
Skip to first unread message

rpay...@gmail.com

unread,
Feb 4, 2015, 10:48:27 PM2/4/15
to adwor...@googlegroups.com
Hi,

I'm new to the API and AdWords in general.  I'm trying to get all of the campaign data for a number of advertisers.  When I'm in the MCC site, I can see all of these advertisers and their IDs.  I see my ID in the top of the screen.  I created a test account with another ID.  The App.config file asks for ClientCustomerId, but none of the IDs I send it seem to work.  I talked to the MCC help hotline, and they said the developer token looked good, and the MCC was linked to the API app.  My gmail account which I use for the MCC was used to create the OAuth data.  Do I somehow need to create another ID with which to create OAuth data, and how would I give this account access to the adwords data if not in MCC?

I have also tried some of the IDs I got from a downloaded report in the MCC ui.  When I rolled back to the v201406 client library, I was able to find 2 campaigns if I didn't set ClientCustomerId, but I couldn't figure out where these came from.

    <add key="DeveloperToken" value="xxxxxxxxxxxxxxxxxxxxxx"/>
    <add key="ClientCustomerId" value="xxx-xxx-xxxx"/>-->

    <!-- OAuth2 configuration -->
    <add key='AuthorizationMethod' value='OAuth2' />
    <add key='OAuth2ClientSecret' value='xxxxxxxxx-xxxxxxxxxxxxxx' />
    <add key='OAuth2RefreshToken' value='1/xxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx' />


Thanks,
Mike

Anash P. Oommen (AdWords API Team)

unread,
Feb 5, 2015, 7:18:00 AM2/5/15
to adwor...@googlegroups.com
Hi Mike,

The value you give for ClientCustomerId depends on what value you have the OAuth2RefreshToken for. If OAuth2RefreshToken is for an MCC account, then you can provide ClientCustomerId for any account under that MCC account. If it is for an individual Advertiser account, then ClientCustomerId should be the customer id for that account.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

rpay...@gmail.com

unread,
Feb 5, 2015, 11:30:50 AM2/5/15
to adwor...@googlegroups.com
Thanks for the reply, but I'm still not perfectly clear on this.  I used an MCC account to create the OAuth2RefreshToken, so I'm not sure what the account "under that MCC account" would be.  When I'm logged in as the MCC account that created the OAuth2RefreshToken, in the MCC environment (in the Client column of the Performance tab), I see a list of 30 clients, each with an account ID.  In the Budget tab, I see these same 30 clients with the account IDs, and more account IDs in the Budget account column.  None of the IDs I've tried from any of these sources seem to work.  Are all of these IDs the wrong thing to try, and is there somewhere else I should look for an account ID?

Anash P. Oommen (AdWords API Team)

unread,
Feb 5, 2015, 11:54:41 AM2/5/15
to adwor...@googlegroups.com
Hi Mike,

So, I assume you are trying to get something as simple as a GetCampaigns example to work. If that's the case, then only an advertiser account can have campaigns, MCC accounts cannot. But based on your description alone, I cannot tell for sure if the child accounts under your MCC are advertiser accounts, or MCC accounts themselves.

My suggestion is this:

1. Set ClientCustomerID to the customer id of your MCC account (it is on the top right corner of the website once you login into the MCC account.

The script will print your account's hierarchical structure. The accounts at the leaf level are usually advertiser accounts, but you can also navigate to these accounts by clicking the account listed under My Client Center tab of your MCC account.

3. Keep looking until you find an account with campaigns in it. Copy its customerId to ClientCustomerId. Now run GetCampaigns.cs, and you should get the campaigns within that account.

If none of this works, then follow the instructions on https://github.com/googleads/googleads-dotnet-lib/wiki/How-to-capture-SOAP-messages to send me the SOAP logs for a call that didn't work. Make sure you use the "Reply to Author" option. Also provide your MCC customer ID. I'll investigate this further.

Cheers,
Anash

rpay...@gmail.com

unread,
Feb 11, 2015, 12:35:22 PM2/11/15
to adwor...@googlegroups.com
Hi,

I tried replying privately to Anash last week, but I haven't heard back from him yet, and I can't seem to find any confirmation that my private post actually went through yet, so let me know if I need to re-send my information, or if there is anyone else I should talk to instead.

Thanks,
Mike

Josh Radcliff (AdWords API Team)

unread,
Feb 11, 2015, 2:12:42 PM2/11/15
to adwor...@googlegroups.com
Hi Mike,

The AuthorizationError.USER_PERMISSION_DENIED error in your sample response indicates that you are using OAuth credentials from a user that does not have access to the clientCustomerId in your request. Please try regenerating your OAuth credentials (refresh token) using these instructions. Make sure that you are logged in as a user with access to the MCC. You may want to use an incognito window in Chrome for this, as that will ensure that you aren't accidentally logged into the wrong account.

Thanks,
Josh, AdWords API Team

rpay...@gmail.com

unread,
Feb 11, 2015, 3:00:07 PM2/11/15
to adwor...@googlegroups.com
Hi, Josh.

I just tried this again, and it still didn't work.  Here are the steps I took:

  1. Logged into the developer console as an account that sees 30 advertisers in the MCC, which also is the account that created the app and developer token.  
  2. Deleted the old Client ID in the OAuth Credentials section.
  3. Created a new credential for a Native Application to generate a new client ID and secret.
  4. Input these new fields into the OAuth2TokenGenerator that came with the .net client library to generate a new refresh token.
  5. Entered the account ID that I used to create the OAuth credentials (this IS also an MCC account), along with the OAuth credentials I created, into app.config.
I'm still getting the same issue, what could I be missing?


Thanks for the help,
Mike

Josh Radcliff (AdWords API Team)

unread,
Feb 11, 2015, 4:56:03 PM2/11/15
to adwor...@googlegroups.com
Hi Mike,

Sorry if I wasn't clear. You don't need a new client ID, but rather you need OAuth credentials generated while logged in as a user who owns (or has access to your MCC).

Could you send the following only to me by clicking Reply to Author?
  1. The user (email address) that you were logged in as when you accepted the OAuth prompt.
  2. The AdWords or MCC account ID you are trying to access in your request. I know you sent one account ID to Anash already, but I just want to make sure I have the information from your latest attempt.
Thanks,
Josh, AdWords API Team

rpay...@gmail.com

unread,
Feb 11, 2015, 5:10:36 PM2/11/15
to adwor...@googlegroups.com
Hi, I just replied privately, but I can never tell if it actually did go through.  Please let me know as soon as possible if you don't get the private reply.

Thanks,
Mike
Reply all
Reply to author
Forward
0 new messages