首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Amazon MWS _GET_MERCHANT_LISTINGS_DATA_为空

Amazon MWS _GET_MERCHANT_LISTINGS_DATA_为空
EN

Stack Overflow用户
提问于 2016-06-02 00:58:13
回答 1查看 500关注 0票数 0

当我调用GetReport时,我只得到制表符分隔的响应的头。但是,当我使用便签簿进行RequestReport、RequestReportList操作时,使用RequestId获取GeneratedReportId,然后使用该Id获取GetReport。我得到了预期的结果。

有人知道为什么我的代码不能像scrathpad那样拉取报表吗?

代码语言:javascript
复制
            RequestReportRequest request = new RequestReportRequest();
            request.Merchant = settings.SellerId;
            request.MarketplaceIdList = new IdList();
            request.MarketplaceIdList.Id = new List<string>(new string[] { settings.MarketplaceId });
            request.ReportType = "_GET_MERCHANT_LISTINGS_DATA_";

            RequestReportResponse requestResponse = _mws.RequestReport(request);
            Thread.Sleep(15000);
            Console.WriteLine(requestResponse.RequestReportResult.ReportRequestInfo.ReportProcessingStatus);
            GetReportRequestListRequest reportRequestListRequest = new GetReportRequestListRequest();

            reportRequestListRequest.Merchant = settings.SellerId;
            List<ReportRequestInfo> requestInfos = new List<ReportRequestInfo>();

            GetReportRequestListResponse reportRequestListResponse = new GetReportRequestListResponse();
            reportRequestListResponse = _mws.GetReportRequestList(reportRequestListRequest);
            GetReportRequestListResult reportRequestListResult = new GetReportRequestListResult();
            reportRequestListResult = reportRequestListResponse.GetReportRequestListResult;
            requestInfos = reportRequestListResult.ReportRequestInfo;

            while (requestInfos[0].ReportProcessingStatus.ToString() != "_DONE_")
            {
                Thread.Sleep(20000);
                reportRequestListResponse = _mws.GetReportRequestList(reportRequestListRequest);
                reportRequestListResult = reportRequestListResponse.GetReportRequestListResult;
                requestInfos = reportRequestListResult.ReportRequestInfo;

            }

            GetReportListRequest listRequest = new GetReportListRequest();
            listRequest.Merchant = settings.SellerId;
            listRequest.ReportRequestIdList = new IdList();
            listRequest.ReportRequestIdList.Id.Add(requestResponse.RequestReportResult.ReportRequestInfo.ReportRequestId);

            GetReportListResponse listResponse = _mws.GetReportList(listRequest);

            GetReportListResult getReportListResult = listResponse.GetReportListResult;

            GetReportRequest reportRequest = new GetReportRequest();
            reportRequest.Merchant = settings.SellerId;
            reportRequest.WithReportId(getReportListResult.ReportInfo[0].ReportId);

            GetReportResponse reportResponse = new GetReportResponse();
            string fileName = dataPath + "\\report-" + getReportListResult.ReportInfo[0].ReportId + ".txt";
            reportRequest.Report = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite); 
            reportResponse = _mws.GetReport(reportRequest); 
EN

回答 1

Stack Overflow用户

发布于 2016-06-02 01:26:51

我从ReportRequest中删除了MarketplaceId,它工作正常。我不知道为什么它没有拉出指定的报告,但它在没有信息的情况下工作。

从上面的代码中删除了这两行。

代码语言:javascript
复制
        request.MarketplaceIdList = new IdList();
        request.MarketplaceIdList.Id = new List<string>(new string[] { settings.MarketplaceId });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37574694

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档