Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google plus 在Ad Exchange卖家REST API中运行大型报告_Google Plus_Google Oauth - Fatal编程技术网

Google plus 在Ad Exchange卖家REST API中运行大型报告

Google plus 在Ad Exchange卖家REST API中运行大型报告,google-plus,google-oauth,Google Plus,Google Oauth,我有一个要求,我必须在Ad Exchange卖家REST API中运行大型报告。 参考网址。 我按照上面提到的步骤仍然只得到100000行,而且响应不是CSV文件 AdExchangeSellerService asv; using (var stream = new FileStream(@"client_secrets.json", FileMode.Open, FileAccess.Read)) { GoogleWe

我有一个要求,我必须在Ad Exchange卖家REST API中运行大型报告。 参考网址。 我按照上面提到的步骤仍然只得到100000行,而且响应不是CSV文件

        AdExchangeSellerService asv;

        using (var stream = new FileStream(@"client_secrets.json", FileMode.Open, FileAccess.Read))
        {
            GoogleWebAuthorizationBroker.Folder = "Tasks.Auth.Store";
            credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, new[] { AdExchangeSellerService.Scope.AdexchangeSeller },
                "abc@gmail.com", CancellationToken.None).Result;

           asv = new AdExchangeSellerService(new AdExchangeSellerService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Test108",
            });


        }

        var startDate = System.DateTime.Now.AddDays(-k).ToString("yyyy-MM-dd");
        var endDate = System.DateTime.Now.AddDays(-k).ToString("yyyy-MM-dd"); 



       var reportRequest = asv.Accounts.Reports.Generate("357435743543565337", startDate, endDate);
        reportRequest.Metric = new List<string> { "AD_REQUESTS", "CLICKS", "MATCHED_AD_REQUESTS_RPM", "EARNINGS", "MATCHED_AD_REQUESTS" };
        reportRequest.Dimension = new List<string> { "DATE", "ADVERTISER_NAME", "AD_TAG_NAME", "COUNTRY_NAME", "PRODUCT_NAME", "TRANSACTION_TYPE_NAME", "BRANDING_TYPE_NAME","AD_UNIT_SIZE_NAME" };


        Google.Apis.Discovery.Parameter param = new Google.Apis.Discovery.Parameter();
        param.Name = "alt";
        param.DefaultValue = "media";
        param.ParameterType = "query";
        param.Pattern = null;
        reportRequest.RequestParameters.Remove("alt");


        reportRequest.RequestParameters.Add("alt", param);
        Google.Apis.AdExchangeSeller.v2_0.Data.Report reportResponse = reportRequest.Execute();
AdExchangeSellerService asv;
使用(var stream=newfilestream(@“client_secrets.json”、FileMode.Open、FileAccess.Read))
{
GoogleWebAuthorizationBroker.Folder=“Tasks.Auth.Store”;
credential=GoogleWebAuthorizationBroker.AuthorizationAsync(GoogleClientSecrets.Load(stream).Secrets,新[]{AdExchangeSellerService.Scope.AdexchangeSeller},
"abc@gmail.com,CancellationToken.None)。结果;
asv=新的AdExchangeSellerService(新的AdExchangeSellerService.Initializer()
{
HttpClientInitializer=凭证,
ApplicationName=“Test108”,
});
}
var startDate=System.DateTime.Now.AddDays(-k).ToString(“yyyy-MM-dd”);
var endDate=System.DateTime.Now.AddDays(-k).ToString(“yyyy-MM-dd”);
var reportRequest=asv.Accounts.Reports.Generate(“357435743543565337”,开始日期,结束日期);
reportRequest.Metric=新列表{“广告请求”、“点击次数”、“匹配广告请求的RPM”、“收益”、“匹配广告请求”};
reportRequest.Dimension=新列表{“日期”、“广告商名称”、“广告标签名称”、“国家名称”、“产品名称”、“交易类型名称”、“品牌类型名称”、“广告单位大小名称”};
Google.api.Discovery.Parameter param=新的Google.api.Discovery.Parameter();
param.Name=“alt”;
param.DefaultValue=“媒体”;
param.ParameterType=“查询”;
param.Pattern=null;
reportRequest.RequestParameters.Remove(“alt”);
reportRequest.RequestParameters.Add(“alt”,param);
Google.api.AdExchangeSeller.v2_0.Data.Report reportResponse=reportRequest.Execute();
我期望的是响应应该是某种CSV文件的格式,但我得到的是某种表格格式的数据。 我在这里遗漏了什么?

reportRequest.Alt=adexchangesellerbaservicerequest.AltEnum.Csv;
reportRequest.Alt = AdExchangeSellerBaseServiceRequest<Google.Apis.AdExchangeSeller.v2_0.Data.Report>.AltEnum.Csv;
        Stream str = File.Create(csvFilePath);
        reportRequest.Download(str);
        str.Close();
        FileInfo fi = new FileInfo(csvFilePath);
        Decompress(fi);
        DataTable reportResponse = ImportExcel(csvFilePath.Replace("zip","csv"),startDate,endDate);
Stream str=File.Create(csvFilePath); reportRequest.Download(str); str.Close(); FileInfo fi=新的FileInfo(csvFilePath); 减压(fi); DataTable reportResponse=ImportExcel(csvFilePath.Replace(“zip”、“csv”)、开始日期、结束日期);

我终于完成了:)

我还在挣扎……有人能帮我一下吗。。