简体   繁体   中英

Amazon MWS _GET_MERCHANT_LISTINGS_DATA_ empty

When I call GetReport I only get the headers for the tab delimited response. However, when I use the scratch pad to, RequestReport, RequestReportList, using the RequestId to get GeneratedReportId and then GetReport with that Id. I get expected results.

Does anyone have an idea why my code doesn't pull the report like the scrathpad does?

            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); 

I removed the MarketplaceId from the ReportRequest and it works fine. I'm not sure why it didn't pull the report with it specified, but it is working without the information.

Removed these 2 lines from above code.

        request.MarketplaceIdList = new IdList();
        request.MarketplaceIdList.Id = new List<string>(new string[] { settings.MarketplaceId });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM