API not allow me to get all MMC client list

57 views
Skip to first unread message

Michal Kubek

unread,
Sep 8, 2017, 3:18:38 AM9/8/17
to AdWords API Forum
I'm trying to get list of all accounts im MMC account.

But all version of AdWords api are returning 

Server raised fault: '[AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'<null>']'

or full stack 

python get_account_hierarchy.py
No handlers could be found for logger "suds.client"
WebFault(u"Server raised fault: '[AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'<null>']'",)
Traceback (most recent call last):
  File "get_account_hierarchy.py", line 107, in <module>
    main(adwords_client, v)
  File "get_account_hierarchy.py", line 70, in main
    page = managed_customer_service.get(selector)
  File "/adwords/venv2/local/lib/python2.7/site-packages/googleads/common.py", line 748, in MakeSoapRequest
    self._datetime_packer) for arg in args])
  File "/adwords/venv2/local/lib/python2.7/site-packages/suds/client.py", line 521, in __call__
    return client.invoke(args, kwargs)
  File "/adwords/venv2/local/lib/python2.7/site-packages/suds/client.py", line 581, in invoke
    result = self.send(soapenv)
  File "/adwords/venv2/local/lib/python2.7/site-packages/suds/client.py", line 619, in send
    description=tostr(e), original_soapenv=original_soapenv)
  File "/adwords/venv2/local/lib/python2.7/site-packages/suds/client.py", line 670, in process_reply
    raise WebFault(fault, replyroot)

When i try to use ACCOUNT_PERFORMANCE_REPORT

{'downloadFormat': 'CSV', 'reportType': 'ACCOUNT_PERFORMANCE_REPORT', 'selector': {'fields': ['AccountCurrencyCode', 'AccountDescriptiveName', 'AccountTimeZone', 'CanManageClients', 'CustomerDescriptiveName', 'ExternalCustomerId', 'IsAutoTaggingEnabled', 'IsTestAccount']}, 'dateRangeType': 'LAST_30_DAYS', 'reportName': 'ACCOUNT_PERFORMANCE_REPORT'}
2017-09-07 15:02:07,762 Request Summary: {'isError': True, 'errorMessage': b'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>AuthenticationError.CLIENT_CUSTOMER_ID_INVALID</type><trigger>&lt;null&gt;</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>', 'includeZeroImpressions': 'True', 'skipReportHeader': 'True', 'clientCustomerId': 'None', 'server': 'adwords.google.com', 'skipColumnHeader': 'False', 'skipReportSummary': 'True'}
Traceback (most recent call last):
  File "/adwords/venv/lib/python3.5/site-packages/googleads/adwords.py", line 1602, in _DownloadReportAsStream
    response = self.url_opener.open(request)
  File "/usr/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "adwords_report_test.py", line 751, in <module>
    main()
  File "adwords_report_test.py", line 43, in with_profiling
    ret = fn(*args, **kwargs)
  File "adwords_report_test.py", line 742, in main
    data = ReportLoader.load_accountPerformance()
  File "adwords_report_test.py", line 43, in with_profiling
    ret = fn(*args, **kwargs)
  File "adwords_report_test.py", line 331, in load_accountPerformance
    return ReportLoader._download_report(selector, report_type, date_range)
  File "adwords_report_test.py", line 200, in _download_report
    skip_report_summary=True, include_zero_impressions=include_zero_impressions)
  File "/adwords/venv/lib/python3.5/site-packages/googleads/adwords.py", line 1275, in DownloadReport
    output, **kwargs)
  File "/adwords/venv/lib/python3.5/site-packages/googleads/adwords.py", line 1545, in _DownloadReport
    response = self._DownloadReportAsStream(post_body, **kwargs)
  File "/adwords/venv/lib/python3.5/site-packages/googleads/adwords.py", line 1618, in _DownloadReportAsStream
    raise self._ExtractError(e)
googleads.errors.AdWordsReportError: AdWords report download failed with HTTP status code: 400

When i specified  CUSTOMER_ID I can download ACCOUNT_PERFORMANCE_REPORT but just for specified  customer not for all of them. 

Somebody know how to get list of all accounts ?

Thanks 

Vincent Racaza (AdWords API Team)

unread,
Sep 8, 2017, 4:42:37 AM9/8/17
to AdWords API Forum
Hi,

For get account hierarchy example, you need to set an MCC Id or clientCustomerId (a client/child account) in the clientCustomerId field of the property file as it will provide the account hierarchies based on the current clientCustomerId/MCC Id.

For your concern on Account Performance Report, if you want to download multiple reports from multiple client accounts under your MCC, then you need to use the parallel report download example.

Kindly do the suggestion first and let me know if you encounter any issues. If there are issues, then kindly provide your clientCustomerId as well as your SOAP request and response logs so I can further investigate. Please use the Reply privately to author option.

Thanks,
Vincent
AdWords API Team
Reply all
Reply to author
Forward
0 new messages