Error when calling getReportFields

226 views
Skip to first unread message

chris h

unread,
Oct 27, 2014, 3:11:18 AM10/27/14
to adwor...@googlegroups.com
Am migrating to v201409

Getting error:

AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED
when calling getReportFields

Reading this:
https://developers.google.com/adwords/api/docs/reference/v201409/ReportDefinitionService

I find in errors section:

CLIENT_CUSTOMER_ID_IS_REQUIRED
Client Customer Id is required if CustomerIdMode is set to CLIENT_EXTERNAL_CUSTOMER_ID. Starting version V201409 ClientCustomerId will be required for all requests except for CustomerService.get

I can't find anything in the docs about setting CustomerIdMode. And anyway, I added the clientCustomerId header to the HTTP POST just like with other calls, but I still get the error. And finally, why does this methods require a Client Customer Id? Might the fields returned be different for different customers?

Сергей Козловский

unread,
Oct 27, 2014, 10:52:11 AM10/27/14
to adwor...@googlegroups.com
Look here how get all fields by report name https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201409/reporting/get_report_fields.py

and here how correctly authorizing https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/authentication/create_adwords_client_without_yaml.py

понедельник, 27 октября 2014 г., 5:11:18 UTC+2 пользователь chris h написал:

chris h

unread,
Oct 27, 2014, 5:22:58 PM10/27/14
to adwor...@googlegroups.com
Thanks, but I'm not using Python. I need to know what has changed with the protocol handshake that is causing my existing application to stop working.

Anash P. Oommen (AdWords API Team)

unread,
Oct 27, 2014, 5:26:46 PM10/27/14
to adwor...@googlegroups.com
Hi Chris,

in v201409, we made client customer id a required field in all the services. We have asked the team to relax this requirement for ReportDefinitionService. Meanwhile, you can work around the issue by setting the clientCustomerId header in the API calls to ReportDefinitionService. Using your MCC CID should work fine.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

chris h

unread,
Oct 27, 2014, 5:33:57 PM10/27/14
to adwor...@googlegroups.com
Hi Anash,
I did add the clientCustomerId to the header (was mentioned in my original post) but I still get this error.  Does it matter which clientCustomerId is used?

Anash P. Oommen (AdWords API Team)

unread,
Oct 27, 2014, 6:55:40 PM10/27/14
to adwor...@googlegroups.com
Hi Chris,

ReportDefinitionService is a SOAP service, so clientCustomerId goes in the SOAP RequestHeader header.

Cheers,
Anash

chris h

unread,
Oct 28, 2014, 12:22:09 AM10/28/14
to adwor...@googlegroups.com
Hi Anash,
Yes, I did add it to the request header. Can you think of anything else which could be causing it not to work?

Anash P. Oommen (AdWords API Team)

unread,
Oct 28, 2014, 12:39:37 PM10/28/14
to adwor...@googlegroups.com
Hi Chris,

Could you post a request id for a failed request, so I can investigate this further? It is part of the SOAP response header.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

chris h

unread,
Oct 28, 2014, 3:12:03 PM10/28/14
to adwor...@googlegroups.com
Hi Anash,
Here is the full response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201409"><requestId>0005067d03ec49e80aecc881b00042ac</requestId><serviceName>ReportDefinitionService</serviceName><methodName>getReportFields</methodName><operations>0</operations><responseTime>47</responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>[AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'&lt;null&gt;']</faultstring><detail><ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201409"><message>[AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'&lt;null&gt;']</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AuthenticationError"><fieldPath></fieldPath><trigger>&lt;null&gt;</trigger><errorString>AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED</errorString><ApiError.Type>AuthenticationError</ApiError.Type><reason>CLIENT_CUSTOMER_ID_IS_REQUIRED</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>

Anash P. Oommen (AdWords API Team)

unread,
Oct 31, 2014, 2:26:55 PM10/31/14
to adwor...@googlegroups.com
Hi Chris,

From the logs, it looks like you are sending clientCustomerId in the HTTP header.

content-type=[text/xml; charset=utf-8]
connection=[Keep-Alive]
Content-Length=[704]
developerToken=[******],
Authorization=[Bearer ******]
clientCustomerId=[********]

<?xml version='1.0' encoding='utf-8'?>
<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'
               xmlns:cm='https://adwords.google.com/api/adwords/cm/v201409'>
   <soap:Header>
      <cm:RequestHeader>
         <cm:developerToken>******</cm:developerToken>
         <cm:userAgent>******</cm:userAgent>
      </cm:RequestHeader>
   </soap:Header>
   <soap:Body>
     <cm:getReportFields>
       <cm:reportType>ACCOUNT_PERFORMANCE_REPORT</cm:reportType>
     </cm:getReportFields>
   </soap:Body>
</soap:Envelope>

This should be in the SOAP headers instead:

      <cm:RequestHeader>
         <cm:developerToken>******</cm:developerToken>
         <cm:userAgent>******</cm:userAgent>
         <cm:clientCustomerId>******</cm:clientCustomerId>
      </cm:RequestHeader>

Cheers,
Anash

chris h

unread,
Nov 2, 2014, 2:01:13 AM11/2/14
to adwor...@googlegroups.com
Thanks - that did it. I kept interpreting "header" as "HTTP header". Putting it in the SOAP header worked.
Still would be nice to eliminate the need for it when getting field metadata.
Reply all
Reply to author
Forward
0 new messages