KeywordPerformanceReportRequest返回空的ReportDownloadUrl [英] KeywordPerformanceReportRequest returns empty ReportDownloadUrl
本文介绍了KeywordPerformanceReportRequest返回空的ReportDownloadUrl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们需要下载关键字效果报告,我使用的是KeywordPerformanceReportRequest(),请参阅https://docs.microsoft.com/en-us/bingads/reporting-service/keywordperformancereportrequest? view = bingads-11
以下是我下载报告的代码,在此我获取reportStatus为成功,但downbloadURL为NULL 。
如果我弄错了,请检查并告诉我。
< br style ="">
注意:我使用类似的代码下载正常运行的搜索查询性能报告。
代码:
=====
//报告WSDL。
$ wsdl =" ; https://api.bingads.microsoft.com/Api/Advertiser/Reporting/V11/ReportingService.svc?singleWsdl" ;;
$ bingAdsPositiveKeywordPerformanceReportDownloadPath = _rootPath。" / data / admanagedkeywords / bingAds PositiveKeywordsPerformanceReport.zip" ;;
$ proxy = ClientProxy :: ConstructWithAccountId($ wsdl,_bingAdsAPIUsername,_bingAdsAPIPassword,_bingAdsAPIDeveloperToken,_bingAdsAPIAccountId,$ authenticationToken);
//范围,时间和列。
$ report = new KeywordPerformanceReportRequest();
$ report-> Format = ReportFormat :: Csv;
$ report-> ReportName ='关键字效果报告';
$ report-> ReturnOnlyCompleteData = false;
$ report - > Aggregation = ReportAggregation :: Summary;
$ report-> Scope = new AccountThroughAdGroupReportScope();
$ report-> Scope-> AccountIds = array(_bingAdsAPIAccountId);
$ report-> Scope-> AdGroups = null;
$ report-> Scope-> Campaigns = null;
$ report-> Time = new ReportTime();
// $ report-> Time-> PredefinedTime = ReportTimePeriod :: Yesterday;
// 您可以使用自定义日期范围或预定义时间。
$ report-> Time-> CustomDateRangeStart = new Date();
$ report-> Time-> CustomDateRangeStart-> Month = $ customDateRangeStartMonth;
$ report-> Time-> CustomDateRangeStart-> Day = $ customDateRangeStartDay;
$ report-> Time-> CustomDateRangeStart-> Year = $ customDateRangeStartYear;
$ report-> Time-> CustomDateRangeEnd = new Date ();
$ report-> Time-> CustomDateRangeEnd-> Month = $ customDateRangeEndMonth;
$ report-> Time- > CustomDateRangeEnd-> Day = $ customDateRangeEndDay;
$ report-> Time-> CustomDateRangeEnd-> Year = $ customDateRangeEndYear;
$ report-> Columns = array(
KeywordPerformanceReportColumn :: CampaignId,
KeywordPerformanceReportColumn: :AdGroupId,
KeywordPerf ormanceReportColumn :: KeywordId,
KeywordPerformanceReportColumn :: Keyword,
KeywordPerformanceReportColumn :: BidMatchType,
KeywordPerformanceReportColumn: :花费,
KeywordPerformanceReportColumn :: Conversions,
KeywordPerformanceReportColumn :: Revenue,
KeywordPerformanceReportColumn :: DestinationUrl,
);
$ encodedReport = new SoapVar($ report,SOAP_ENC_OBJECT,'KeywordPerformanceReportRequest',$ proxy-> GetNamespace());
$ debugClass-> displayDebug(" encodedReport",$ encodedReport, "选择");
>
$ reportRequestId = $ bingAdsClass-> SubmitGenerateReport($ proxy,$ encodedReport);
printf(" Report Request ID:%s\\\
\ n",$ reportRequestId);
$ waitTime = 30 * 1;
$ reportRequestStatus = null;
//此示例每30秒轮询一次,最多5分钟。< br style ="">
//在制作中,您可以每1至2分钟轮询状态长达一小时。
//如果通话成功,请停止轮询。如果通话或
for ($ i = 0; $ i< 10; $ i ++){
sleep($ waitTime);
// PollGenerateReport帮助方法调用相应的Bing Ads服务操作
//获取报告请求状态。
$ reportRequestStatus = $ bingAdsClass-> PollGenerateReport(
$ proxy,
$ reportRequestId
);
if($ reportRequestStatus-> Status == ReportRequestStatusType :: Success || $ reportRequestStatus-> Status == ReportRequestStatusType :: Error ){
break;
}
}
$ debugClass-> displayDebug(" reportRequestStatus",$ reportRequestStatus," Select");
if($ reportRequestStatus!= null ){
if($ r eportRequestStatus-> Status == ReportRequestStatusType :: Success){
$ reportDownloadUrl = $ reportRequestStatus-> ReportDownloadUrl;
echo"< br /> reportDownloadUrl:"。$ reportDownloadUrl;
}
}
" reportDownloadUrl" =>返回NULL。而不是这个,我期待一个URL。
谢谢
以下是我下载报告的代码,在此我获取reportStatus为成功,但downbloadURL为NULL 。
如果我弄错了,请检查并告诉我。
< br style ="">
注意:我使用类似的代码下载正常运行的搜索查询性能报告。
代码:
=====
//报告WSDL。
$ wsdl =" ; https://api.bingads.microsoft.com/Api/Advertiser/Reporting/V11/ReportingService.svc?singleWsdl" ;;
$ bingAdsPositiveKeywordPerformanceReportDownloadPath = _rootPath。" / data / admanagedkeywords / bingAds PositiveKeywordsPerformanceReport.zip" ;;
$ proxy = ClientProxy :: ConstructWithAccountId($ wsdl,_bingAdsAPIUsername,_bingAdsAPIPassword,_bingAdsAPIDeveloperToken,_bingAdsAPIAccountId,$ authenticationToken);
//范围,时间和列。
$ report = new KeywordPerformanceReportRequest();
$ report-> Format = ReportFormat :: Csv;
$ report-> ReportName ='关键字效果报告';
$ report-> ReturnOnlyCompleteData = false;
$ report - > Aggregation = ReportAggregation :: Summary;
$ report-> Scope = new AccountThroughAdGroupReportScope();
$ report-> Scope-> AccountIds = array(_bingAdsAPIAccountId);
$ report-> Scope-> AdGroups = null;
$ report-> Scope-> Campaigns = null;
$ report-> Time = new ReportTime();
// $ report-> Time-> PredefinedTime = ReportTimePeriod :: Yesterday;
// 您可以使用自定义日期范围或预定义时间。
$ report-> Time-> CustomDateRangeStart = new Date();
$ report-> Time-> CustomDateRangeStart-> Month = $ customDateRangeStartMonth;
$ report-> Time-> CustomDateRangeStart-> Day = $ customDateRangeStartDay;
$ report-> Time-> CustomDateRangeStart-> Year = $ customDateRangeStartYear;
$ report-> Time-> CustomDateRangeEnd = new Date ();
$ report-> Time-> CustomDateRangeEnd-> Month = $ customDateRangeEndMonth;
$ report-> Time- > CustomDateRangeEnd-> Day = $ customDateRangeEndDay;
$ report-> Time-> CustomDateRangeEnd-> Year = $ customDateRangeEndYear;
$ report-> Columns = array(
KeywordPerformanceReportColumn :: CampaignId,
KeywordPerformanceReportColumn: :AdGroupId,
KeywordPerf ormanceReportColumn :: KeywordId,
KeywordPerformanceReportColumn :: Keyword,
KeywordPerformanceReportColumn :: BidMatchType,
KeywordPerformanceReportColumn: :花费,
KeywordPerformanceReportColumn :: Conversions,
KeywordPerformanceReportColumn :: Revenue,
KeywordPerformanceReportColumn :: DestinationUrl,
);
$ encodedReport = new SoapVar($ report,SOAP_ENC_OBJECT,'KeywordPerformanceReportRequest',$ proxy-> GetNamespace());
$ debugClass-> displayDebug(" encodedReport",$ encodedReport, "选择");
>
$ reportRequestId = $ bingAdsClass-> SubmitGenerateReport($ proxy,$ encodedReport);
printf(" Report Request ID:%s\\\
\ n",$ reportRequestId);
$ waitTime = 30 * 1;
$ reportRequestStatus = null;
//此示例每30秒轮询一次,最多5分钟。< br style ="">
//在制作中,您可以每1至2分钟轮询状态长达一小时。
//如果通话成功,请停止轮询。如果通话或
for ($ i = 0; $ i< 10; $ i ++){
sleep($ waitTime);
// PollGenerateReport帮助方法调用相应的Bing Ads服务操作
//获取报告请求状态。
$ reportRequestStatus = $ bingAdsClass-> PollGenerateReport(
$ proxy,
$ reportRequestId
);
if($ reportRequestStatus-> Status == ReportRequestStatusType :: Success || $ reportRequestStatus-> Status == ReportRequestStatusType :: Error ){
break;
}
}
$ debugClass-> displayDebug(" reportRequestStatus",$ reportRequestStatus," Select");
if($ reportRequestStatus!= null ){
if($ r eportRequestStatus-> Status == ReportRequestStatusType :: Success){
$ reportDownloadUrl = $ reportRequestStatus-> ReportDownloadUrl;
echo"< br /> reportDownloadUrl:"。$ reportDownloadUrl;
}
}
" reportDownloadUrl" =>返回NULL。而不是这个,我期待一个URL。
谢谢
We need to download the keyword performance report, I am using KeywordPerformanceReportRequest() referred from here https://docs.microsoft.com/en-us/bingads/reporting-service/keywordperformancereportrequest?view=bingads-11
Below is my code to download the report, in this I am getting reportStatus as a success but downbloadURL as NULL.
Please check and let me know if I am making anything wrong with it.
Note: I am using similar code to download the search query performance report it is working correctly.
Code:
=====
// Reporting WSDL.
$wsdl = "https://api.bingads.microsoft.com/Api/Advertiser/Reporting/V11/ReportingService.svc?singleWsdl";
$bingAdsPositiveKeywordPerformanceReportDownloadPath = _rootPath."/data/admanagedkeywords/bingAdsPositiveKeywordsPerformanceReport.zip";
$proxy = ClientProxy::ConstructWithAccountId($wsdl, _bingAdsAPIUsername, _bingAdsAPIPassword, _bingAdsAPIDeveloperToken, _bingAdsAPIAccountId, $authenticationToken);
// Scope, Time and Columns.
$report = new KeywordPerformanceReportRequest();
$report->Format = ReportFormat::Csv;
$report->ReportName = 'Keywords Performance Report';
$report->ReturnOnlyCompleteData = false;
$report->Aggregation = ReportAggregation::Summary;
$report->Scope = new AccountThroughAdGroupReportScope();
$report->Scope->AccountIds = array(_bingAdsAPIAccountId);
$report->Scope->AdGroups = null;
$report->Scope->Campaigns = null;
$report->Time = new ReportTime();
// $report->Time->PredefinedTime = ReportTimePeriod::Yesterday;
// You may either use a custom date range or predefined time.
$report->Time->CustomDateRangeStart = new Date();
$report->Time->CustomDateRangeStart->Month = $customDateRangeStartMonth;
$report->Time->CustomDateRangeStart->Day = $customDateRangeStartDay;
$report->Time->CustomDateRangeStart->Year = $customDateRangeStartYear;
$report->Time->CustomDateRangeEnd = new Date();
$report->Time->CustomDateRangeEnd->Month = $customDateRangeEndMonth;
$report->Time->CustomDateRangeEnd->Day = $customDateRangeEndDay;
$report->Time->CustomDateRangeEnd->Year = $customDateRangeEndYear;
$report->Columns = array (
KeywordPerformanceReportColumn::CampaignId,
KeywordPerformanceReportColumn::AdGroupId,
KeywordPerformanceReportColumn::KeywordId,
KeywordPerformanceReportColumn::Keyword,
KeywordPerformanceReportColumn::BidMatchType,
KeywordPerformanceReportColumn::Spend,
KeywordPerformanceReportColumn::Conversions,
KeywordPerformanceReportColumn::Revenue,
KeywordPerformanceReportColumn::DestinationUrl,
);
$encodedReport = new SoapVar($report, SOAP_ENC_OBJECT, 'KeywordPerformanceReportRequest', $proxy->GetNamespace());
$debugClass->displayDebug("encodedReport", $encodedReport, "Select");
$reportRequestId = $bingAdsClass->SubmitGenerateReport($proxy, $encodedReport);
printf("Report Request ID: %s\n\n", $reportRequestId);
$waitTime = 30 * 1;
$reportRequestStatus = null;
// This sample polls every 30 seconds up to 5 minutes.
// In production, you may poll the status every 1 to 2 minutes for up to one hour.
// If the call succeeds, stop polling. If the call or
// download fails, the call throws a fault.
for ($i = 0; $i < 10; $i++) {
sleep($waitTime);
// PollGenerateReport helper method calls the corresponding Bing Ads service operation
// to get the report request status.
$reportRequestStatus = $bingAdsClass->PollGenerateReport(
$proxy,
$reportRequestId
);
if ($reportRequestStatus->Status == ReportRequestStatusType::Success || $reportRequestStatus->Status == ReportRequestStatusType::Error) {
break;
}
}
$debugClass->displayDebug("reportRequestStatus",$reportRequestStatus, "Select");
if ($reportRequestStatus != null) {
if ($reportRequestStatus->Status == ReportRequestStatusType::Success) {
$reportDownloadUrl = $reportRequestStatus->ReportDownloadUrl;
echo "<br/>reportDownloadUrl: ".$reportDownloadUrl;
}
}
"reportDownloadUrl" => returns as NULL. instead of this, I am expecting an URL.
Thanks
Below is my code to download the report, in this I am getting reportStatus as a success but downbloadURL as NULL.
Please check and let me know if I am making anything wrong with it.
Note: I am using similar code to download the search query performance report it is working correctly.
Code:
=====
// Reporting WSDL.
$wsdl = "https://api.bingads.microsoft.com/Api/Advertiser/Reporting/V11/ReportingService.svc?singleWsdl";
$bingAdsPositiveKeywordPerformanceReportDownloadPath = _rootPath."/data/admanagedkeywords/bingAdsPositiveKeywordsPerformanceReport.zip";
$proxy = ClientProxy::ConstructWithAccountId($wsdl, _bingAdsAPIUsername, _bingAdsAPIPassword, _bingAdsAPIDeveloperToken, _bingAdsAPIAccountId, $authenticationToken);
// Scope, Time and Columns.
$report = new KeywordPerformanceReportRequest();
$report->Format = ReportFormat::Csv;
$report->ReportName = 'Keywords Performance Report';
$report->ReturnOnlyCompleteData = false;
$report->Aggregation = ReportAggregation::Summary;
$report->Scope = new AccountThroughAdGroupReportScope();
$report->Scope->AccountIds = array(_bingAdsAPIAccountId);
$report->Scope->AdGroups = null;
$report->Scope->Campaigns = null;
$report->Time = new ReportTime();
// $report->Time->PredefinedTime = ReportTimePeriod::Yesterday;
// You may either use a custom date range or predefined time.
$report->Time->CustomDateRangeStart = new Date();
$report->Time->CustomDateRangeStart->Month = $customDateRangeStartMonth;
$report->Time->CustomDateRangeStart->Day = $customDateRangeStartDay;
$report->Time->CustomDateRangeStart->Year = $customDateRangeStartYear;
$report->Time->CustomDateRangeEnd = new Date();
$report->Time->CustomDateRangeEnd->Month = $customDateRangeEndMonth;
$report->Time->CustomDateRangeEnd->Day = $customDateRangeEndDay;
$report->Time->CustomDateRangeEnd->Year = $customDateRangeEndYear;
$report->Columns = array (
KeywordPerformanceReportColumn::CampaignId,
KeywordPerformanceReportColumn::AdGroupId,
KeywordPerformanceReportColumn::KeywordId,
KeywordPerformanceReportColumn::Keyword,
KeywordPerformanceReportColumn::BidMatchType,
KeywordPerformanceReportColumn::Spend,
KeywordPerformanceReportColumn::Conversions,
KeywordPerformanceReportColumn::Revenue,
KeywordPerformanceReportColumn::DestinationUrl,
);
$encodedReport = new SoapVar($report, SOAP_ENC_OBJECT, 'KeywordPerformanceReportRequest', $proxy->GetNamespace());
$debugClass->displayDebug("encodedReport", $encodedReport, "Select");
$reportRequestId = $bingAdsClass->SubmitGenerateReport($proxy, $encodedReport);
printf("Report Request ID: %s\n\n", $reportRequestId);
$waitTime = 30 * 1;
$reportRequestStatus = null;
// This sample polls every 30 seconds up to 5 minutes.
// In production, you may poll the status every 1 to 2 minutes for up to one hour.
// If the call succeeds, stop polling. If the call or
// download fails, the call throws a fault.
for ($i = 0; $i < 10; $i++) {
sleep($waitTime);
// PollGenerateReport helper method calls the corresponding Bing Ads service operation
// to get the report request status.
$reportRequestStatus = $bingAdsClass->PollGenerateReport(
$proxy,
$reportRequestId
);
if ($reportRequestStatus->Status == ReportRequestStatusType::Success || $reportRequestStatus->Status == ReportRequestStatusType::Error) {
break;
}
}
$debugClass->displayDebug("reportRequestStatus",$reportRequestStatus, "Select");
if ($reportRequestStatus != null) {
if ($reportRequestStatus->Status == ReportRequestStatusType::Success) {
$reportDownloadUrl = $reportRequestStatus->ReportDownloadUrl;
echo "<br/>reportDownloadUrl: ".$reportDownloadUrl;
}
}
"reportDownloadUrl" => returns as NULL. instead of this, I am expecting an URL.
Thanks
推荐答案
您好。
您确定帐户中是否有指定日期的数据?根据
doc :
Are you sure there is data in the account for the specified dates? Per the doc:
即使在 状态   ;是
设置为 成功 ,
如果没有可用于提交的报告参数的数据,则此元素可以为nil。
我希望这有帮助!
Eric
这篇关于KeywordPerformanceReportRequest返回空的ReportDownloadUrl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文