找到你要的答案

Q:Where can I get adwords report response xml fixture/mock

Q:我在哪里可以买到AdWords报告响应XML夹具/模拟

Hi fellow stackoverflowers! :)

I am wiring my application with adwords API, and want it to display reports based on the retrieved data. My problem is that I am using test account that have no data that could be used for reporting, and so far us I understand testing account don`t provide any. According to the https://developers.google.com/adwords/api/docs/test-accounts#developing_with_test_accounts I should fake data. I am totally fine writing tests and feed then with fixtures, expect I can't find any relevant example of how the response XML will look like so I can create my own fixtures.

For example: I want to pull campaign performance report, and segment it by Week

<reportDefinition>
    <selector>
      <fields>CampaignId</fields>
      <fields>Clicks</fields>
      <fields>Impressions</fields>
      <fields>Week</fields>
      <predicates>
        <field>CampaignId</field>
        <operator>EQUALS</operator>
        <values>111111</values>
      </predicates>
      <dateRange>
        <min>20150201</min>
        <max>20150601</max>
      </dateRange>
    </selector>
    <reportName>Campaign Performance Report NAme</reportName>
    <reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType>
    <dateRangeType>CUSTOM_DATE</dateRangeType>
    <downloadFormat>XML</downloadFormat>
    <includeZeroImpressions>true</includeZeroImpressions>
</reportDefinition>

Which gives me response:

<report>
<report-name name="Campaign Performance Report NAme" />
<date-range date="Feb 1, 2015-Jun 1, 2015" />
<table>
  <columns>
    <column name="campaignID" display="Campaign ID" />
    <column name="clicks" display="Clicks" />
    <column name="impressions" display="Impressions" />
    <column name="week" display="Week" />
  </columns>
</table>

What will be the response with actual data? How it is going to look like in case segmentation will be set to: Date, Month, Quarter, Year?

I have tried to find any xml example on the web and github without luck. Can you please share response examples or point me to the doc, where it says how can I "generate" data for my test acount? Thank you!

嗨,各位stackoverflowers!:)

我是接线与AdWords API我的申请,并希望它显示基于获取的数据报告。我的问题是,我使用的测试帐户,没有数据,可用于报告,到目前为止,我们了解测试帐户不提供任何。根据https:/ /开发商。谷歌。COM /广告/ API文档/测试帐户/ # developing_with_test_accounts我应该假数据。我很好的写测试和饲料,然后与夹具,预计我找不到任何相关的例子如何响应XML将看起来像这样,我可以创建自己的夹具。

For example: I want to pull campaign performance report, and segment it by Week

<reportDefinition>
    <selector>
      <fields>CampaignId</fields>
      <fields>Clicks</fields>
      <fields>Impressions</fields>
      <fields>Week</fields>
      <predicates>
        <field>CampaignId</field>
        <operator>EQUALS</operator>
        <values>111111</values>
      </predicates>
      <dateRange>
        <min>20150201</min>
        <max>20150601</max>
      </dateRange>
    </selector>
    <reportName>Campaign Performance Report NAme</reportName>
    <reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType>
    <dateRangeType>CUSTOM_DATE</dateRangeType>
    <downloadFormat>XML</downloadFormat>
    <includeZeroImpressions>true</includeZeroImpressions>
</reportDefinition>

这给了我回应:

<report>
<report-name name="Campaign Performance Report NAme" />
<date-range date="Feb 1, 2015-Jun 1, 2015" />
<table>
  <columns>
    <column name="campaignID" display="Campaign ID" />
    <column name="clicks" display="Clicks" />
    <column name="impressions" display="Impressions" />
    <column name="week" display="Week" />
  </columns>
</table>

实际数据会有什么反应?它是如何看起来像案件分割将设置为:日期,月,季度,年?

I have tried to find any xml example on the web and github without luck. Can you please share response examples or point me to the doc, where it says how can I "generate" data for my test acount? Thank you!

answer1: 回答1:

eolexe, I am assuming you did not receive an error for the Campaign Performance Report you tried to fetch. If that is the case then that means there was no match for the predicates and date range you had entered. This why you do not have the rows element within the XML. Also some attributes are are not filterable. But I am pretty sure the CampaignID is. Take a close look at the API just to be sure. You need to migrate to version 201502 because 201402 is deprecated and 201409's sunset day is in July.

eolexe,我假设你没有收到错误的运动性能报告你想取。如果是这样的话,这意味着没有匹配的谓词和日期范围,你已经进入。这就是为什么在xml中没有行元素的原因。也有一些属性是不可过滤。但我敢肯定的是campaignid。仔细看看API,以确保。你需要迁移到201502版,因为201402已被废弃,201409节是在七月的日落。

answer2: 回答2:

I have been working on AdWords API for reporting purpose for years, and I can tell you up till now there is still no official sample XML or CSV given. So I simply test the program using real account data...

I don't pick XML as the response type so I cannot really address your question, but you may wish to know that the XML response does not return a total row. That's why I always pick CSV/TSV format.

我一直在AdWords API报告的目的,多年来,我可以告诉你,直到现在还没有官方给出的示例XML或CSV。所以我只是用真实账户数据测试程序…

我不选择XML作为响应类型,所以我不能真正解决您的问题,但您可能希望知道XML响应不返回一个总行。这就是为什么我总是选择CSV / TSV格式。

google-adwords  adwords-apiv201402