C# AdWords API:非MCC账户的客户列表

C# AdWords API:非MCC账户的客户列表,c#,xml,soap,google-ads-api,C#,Xml,Soap,Google Ads Api,我想获得分配给认证帐户的AdWords客户端列表(我使用OAuth) 第一次尝试是使用ServicedAccountService和此XML请求 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

我想获得分配给认证帐户的AdWords客户端列表(我使用OAuth)

第一次尝试是使用ServicedAccountService和此XML请求

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <RequestHeader xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
      <developerToken xmlns="https://adwords.google.com/api/adwords/mcm/v201109">[[DEV_TOKEN]]</developerToken>
    </RequestHeader>
  </soap:Header>
  <soap:Body>
    <get xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
      <selector>
        <enablePaging>false</enablePaging>
      </selector>
    </get>
  </soap:Body>
</soap:Envelope>

[[DEV_TOKEN]]
假的
但它只适用于MCC账户。对于普通谷歌账户,我得到了空数据集

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
      <ns2:requestId>0004bc71cee633d00aecb0aa000060ca</ns2:requestId>
      <ns2:serviceName>ServicedAccountService</ns2:serviceName>
      <ns2:methodName>get</ns2:methodName>
      <ns2:operations>0</ns2:operations>
      <ns2:responseTime>230</ns2:responseTime>
      <ns2:units>0</ns2:units>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <getResponse xmlns="https://adwords.google.com/api/adwords/mcm/v201109" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109">
      <rval>
        <accounts>
          <customerId>0</customerId>
          <canManageClients>false</canManageClients>
        </accounts>
      </rval>
    </getResponse>
  </soap:Body>
</soap:Envelope>

0004BC71CE633D00AECB0AA000060CA
ServicedAccountService
得到
0
230
0
我可以为MCC和非MCC帐户使用其他XML(InfoService)

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <RequestHeader xmlns="https://adwords.google.com/api/adwords/info/v201109">
      <developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[DEV_TOKEN]]</developerToken>
    </RequestHeader>
  </soap:Header>
  <soap:Body>
    <get xmlns="https://adwords.google.com/api/adwords/info/v201109">
      <selector>
        <dateRange>
          <min xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[START_DATE]]</min>
          <max xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[END_DATE]]</max>
        </dateRange>
        <includeSubAccounts>true</includeSubAccounts>
        <apiUsageType>UNIT_COUNT_FOR_CLIENTS</apiUsageType>
      </selector>
    </get>
  </soap:Body>
</soap:Envelope>

[[DEV_TOKEN]]
[[开始日期]]
[[结束日期]]
真的
客户的单位计数
但返回的数据不正确-未列出所有帐户。或者根本没有返回数据

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/info/v201109">
            <ns2:requestId>0004bc7121a910e80a97030d000051e7</ns2:requestId>
            <ns2:serviceName>InfoService</ns2:serviceName>
            <ns2:methodName>get</ns2:methodName>
            <ns2:operations>1</ns2:operations>
            <ns2:responseTime>1206</ns2:responseTime>
            <ns2:units>1</ns2:units>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <getResponse xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/info/v201109">
            <rval>
                <cost>0</cost>
            </rval>
        </getResponse>
    </soap:Body>
</soap:Envelope>

0004bc7121a910e80a97030d000051e7
信息服务
得到
1.
1206
1.
0

是否有其他方法获取AdWords帐户的客户列表?非常感谢。

我也遇到了这个问题,可以确认这不是ServicedAccountService的正确行为;这是一个:如果您将基本帐户链接到一个MCC,那么您可以使用基本帐户进行身份验证,并使用ServicedAccountService获取帐户详细信息,但是如果帐户未链接,那么您将遇到此问题


如果您只想获取帐户的客户id,还可以使用,这不会出现相同的问题。

我问题的最后一个xml是InfoService的答复。它也不正确-它不显示所有帐户,只显示通过API访问的帐户,这不是我想要达到的。您需要对MCC帐户使用ServicedAccountService,对普通帐户使用InfoService。我首先调用ServicedAccountService,然后如果id字段中的值为零,则调用InfoService。在谷歌解决这个问题之前,这只是一个变通办法。