使用R报告数据 - 获取ReportRequestId [英] Reporting Data with R - get ReportRequestId

查看:69
本文介绍了使用R报告数据 - 获取ReportRequestId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我尝试将Bing Ads Api中的数据直接加载到统计工具
R

I try to directly load data from the Bing Ads Api into the statistic tool R.

我使用R中的 httr  包,它使用
Curl  以启用R与API之间的连接。

I make use of the httr package within R, which uses Curl to enable a connection between R and the API.

根据API manual 我尝试
SubmitGenerateReport ,但我没有收到 ReportRequestId

According to the API manualI try to SubmitGenerateReport, but I do not receive a ReportRequestId.

这是R代码:

#loads httr package

#loads the httr package

library(httr)

library(httr)

#create语句,http soap对象的主体

#creates the statement, body of http soap object

body< - '< s:Body>

  < SubmitGenerateReportRequest xmlns =" https://guideads.microsoft.com/Reporting/v9">

  < ReportRequest i:nil =" false" i:type =" KeywordPerformanceReportRequest">

  <格式i:nil =" false"> Csv< /格式>

  <语言i:nil =" false">英文< /语言>

  < ReportName i:nil =" false"> Test< / ReportName>

  < ReturnOnlyCompleteData> false< / ReturnOnlyCompleteData>

  <聚合>每日< /聚合>

  < Columns> \

 < KeywordPerformanceReportColumn> AccountName< / KeywordPerformanceReportColumn> \

 < KeywordPerformanceReportColumn> CampaignName< / KeywordPerformanceReportColumn> \

 < KeywordPerformanceReportColumn>关键字< / KeywordPerformanceReportColumn> \

 < KeywordPerformanceReportColumn> TimePeriod< / KeywordPerformanceReportColumn> \

  < KeywordPerformanceReportColumn>展示次数< / KeywordPerformanceReportColumn> \

 < KeywordPerformanceReportColumn>转化< / KeywordPerformanceReportColumn> \

 < / Columns> \

 <范围> \

 < AccountIds> MyAccountId< / AccountIds> \

 < / Scope> ; \

 <时间> \

 < PredefinedTime> LastSevenDays< / PredefinedTime> \

  & LT; /时间> \

  < / ReportRequest>

  < / SubmitGenerateReportRequest>

  < / s:正文>'

body <- '<s:Body>
  <SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v9">
  <ReportRequest i:nil="false" i:type="KeywordPerformanceReportRequest">
  <Format i:nil="false">Csv</Format>
  <Language i:nil="false">English</Language>
  <ReportName i:nil="false">Test</ReportName>
  <ReturnOnlyCompleteData>false</ReturnOnlyCompleteData>
  <Aggregation>Daily</Aggregation>
  <Columns>\
 <KeywordPerformanceReportColumn>AccountName</KeywordPerformanceReportColumn>\
 <KeywordPerformanceReportColumn>CampaignName</KeywordPerformanceReportColumn>\
 <KeywordPerformanceReportColumn>Keyword</KeywordPerformanceReportColumn>\
 <KeywordPerformanceReportColumn>TimePeriod</KeywordPerformanceReportColumn>\
 <KeywordPerformanceReportColumn>Impressions</KeywordPerformanceReportColumn>\
 <KeywordPerformanceReportColumn>Conversions</KeywordPerformanceReportColumn>\
 </Columns>\
 <Scope>\
 <AccountIds>MyAccountId</AccountIds>\
 </Scope>\
 <Time>\
 <PredefinedTime>LastSevenDays</PredefinedTime>\
 </Time>\
  </ReportRequest>
  </SubmitGenerateReportRequest>
  </s:Body>'

#post api request

# post the api request

Api返回以下内容:

The Api returns following:

我真的很期待任何帮助吗?

I am really looking forward to any help?

亲切的问候,

Johannes

Kind regards,
Johannes

推荐答案

约翰内斯,

感谢您提出这个问题。我们目前没有将R与API一起使用的代码示例。话虽如此,这是将数据科学与API相结合的一种迷人方法。我唯一一次看到Curl与API一起使用的是使用Bulk
API并且没有报告。批量API允许我们使用任何可以发送HTTP POSTS / GETS的工具下载报告和发布数据。它还具有在非常大的数据集中进行操作的优势。

Thank you for raising this question. We currently don't have code samples for using R with the API. Having said, this is a fascinating approach to combine data science with the API. The only time I have seen Curl being used with the API was using the Bulk API and not reporting. Bulk API allows us to download reports and post data using any tool that can send HTTP POSTS/GETS. It also has the advantage of carrying operations in really large data sets.

请参考批量API并尝试使用它。我无法保证它能够正常工作,但最明显的是使用Curl。

Please reference the Bulk API and try to use R with it. I cannot guarantee that it work, but it is the most obvious to use with Curl.

批量API参考:

http://msdn.microsoft。 com / zh-CN / library / jj134984.aspx

谢谢,

Itai


这篇关于使用R报告数据 - 获取ReportRequestId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆