Hello J.E., Yes, you're correct in your analysis. I don't actually know why the AccountInfo response object doesn't have a field for the email address associated with the account in question. If I had to guess, I'd say it's because there can be multiple email addresses associated with the same account, but that could be obviously worked around by either returning an array of strings or simply returning the "primary" email address, like the new ClientAccountInfo object returns.
Unless you know for a fact that the email addresses associated with your AdWords accounts are going to change very frequently (and moreover, they're going to change in a way such that the address used for one account might be disassociated and then reused for another account), then I think you're best approach is to traverse your account structure as detailed above and cache the mappings locally on a semi-permanent basis. Cheers, -Jeff Posnick, AdWords API Team On Nov 24, 3:01 pm, "j.e.frank" <[EMAIL PROTECTED]> wrote: > In my AdWords API program, I need to know both the clientEmail and the > customerId for all of my managed accounts. I know how to get the > customerId if I have the clientEmail, but I don't know how to do the > reverse, at least not easily. > > To get the customerId given the clientEmail, I just login via the API > using the clientEmail header to make the "effective user" be the > client account in question, and then call AccountService.getAccountInfo > (), and access the customerId field of the returned object. > > I can also control the "effective user" by specifying the customerId > instead of the clientEmail, which is great, but there is no > clientEmail field of the AccountInfo object, as far as I can tell. > > The only workaround that I can think of so far, to get the clientEmail > given the customerId, goes like this: login with the effective user of > the MCC account. Call getClientAccounts to receive an array of client > email addresses. For each one in turn, use that as the clientEmail to > login and call getAccountInfo, and check if the returned customerId > matches the one I am looking for. This seems quite inefficient and > wastes API quota as well. Is there a simpler way? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en -~----------~----~----~----~------~----~------~--~---
