试图获得报告但总是只得到 "ReportDownloadError.MISSING_PARAMETER" "Missing report definition"

Trying to get report but always just get "ReportDownloadError.MISSING_PARAMETER" "Missing report definition"

我在使用 adwords API 时遇到了问题,想知道您是否可以帮助我。

我调用了 adwords api http:// adwords.google.com/api/adwords/reportdownload/v201603.

这个 api 一直工作到昨天,但今天停止工作了。

我阅读了参考页并试图找出答案,但到目前为止我们只得到了 'api error' 的回应。

这是这些页面的链接。

https:// developers.google.com/adwords/api/docs/guides/reporting?hl=en

https://adwords.google.com/api/adwords/reportdownload/v201603/reportDefinition.xsd

下面是我们写的,

API_VERSION='v201603'
REQUEST='__rdxml=<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/'${API_VERSION}'">
    <selector>
      <fields>Ctr</fields>
      <fields>Date</fields>
    </selector>
    <reportName>ACCOUNT_PERFORMANCE_REPORT</reportName>
    <reportType>ACCOUNT_PERFORMANCE_REPORT</reportType>
    <dateRangeType>LAST_MONTH</dateRangeType>
    <downloadFormat>XML</downloadFormat>
</reportDefinition>'

SIZE=${#REQUEST}

echo ${REQUEST} | \
curl -X POST \
    -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
    -H 'Authorization: Bearer '${REFREASH_TOKEN} \
    -H 'developerToken: '${DEVELOPER_TOKEN} \
    -H 'clientCustomerId: '${ACCOUNT_ID} \
    -H 'skipReportHeader: False' \
    -H 'skipColumnHeader: False' \
    -H 'skipReportSummary: False' \
    -H 'includeZeroImpressions: False' \
    -H 'Host: adwords.google.com' \
    -H 'Content-Length: '${SIZE} \
    -H 'Expect: 100-continue' \
    -H 'Connection: Keep-Alive' \
  --data-urlencode @- \
  --verbose \
  https://adwords.google.com/api/adwords/reportdownload/${API_VERSION}

执行代码后,我得到以下响应

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<reportDownloadError>
  <ApiError>
    <type>ReportDownloadError.MISSING_PARAMETER</type>
    <trigger>Missing report definition</trigger>
    <fieldPath/>
  </ApiError>
</reportDownloadError>

希望您能指导我们如何调用报告下载api。

提前致谢,

我尝试了 python 的 AdWords API 客户端库。 https://github.com/googleads/googleads-python-lib/blob/master/README.md#getting-started

所以,我得到了 Wrong 错误。

Traceback (most recent call last):
  File "examples/adwords/v201607/reporting/download_criteria_report.py", line 61, in <module>
    main(adwords_client)
  File "examples/adwords/v201607/reporting/download_criteria_report.py", line 56, in main
    skip_report_summary=False)
  File "/Users/my/.pyenv/versions/anaconda3-2.3.0/lib/python3.4/site-packages/googleads/adwords.py", line 1169, in DownloadReport
    output, **kwargs)
  File "/Users/my/.pyenv/versions/anaconda3-2.3.0/lib/python3.4/site-packages/googleads/adwords.py", line 1439, in _DownloadReport
    response = self._DownloadReportAsStream(post_body, **kwargs)
  File "/Users/my/.pyenv/versions/anaconda3-2.3.0/lib/python3.4/site-packages/googleads/adwords.py", line 1492, in _DownloadReportAsStream
    raise self._ExtractError(e)
googleads.errors.AdWordsReportBadRequestError: Type: AuthorizationError.USER_PERMISSION_DENIED
Trigger: <null>
Field Path: None

此问题的原因是为已删除的用户创建刷新令牌。

注册oauth帐户。创建刷新令牌。此问题已解决。

感谢您通读。 到现在为止,我想你已经习惯了我有趣的英文写作。