使用MWS API获取FBA库存对帐报告数据

时间:2018-10-07 19:12:34

标签: c# amazon-web-services amazon-mws scratchpad

我正在寻找如何使用List of api names for seller central fulfillment reports 或任何其他客户端库或使用C# Client Library来查询未记录的MWS API的库存对帐报告(Amazon MWS Scratchpad) -对于后者,对我来说不清楚用于设置MarketplaceIdList.Id.1,StartDate,EndDate和ReportOptions字段的值的规则:我正在像其他报表类型一样设置前三个字段, ReportOptions字段为空-通过C#库对_GET_FBA_RECONCILIATION_REPORT_DATA_报告的MWS API调用被接受,但最终状态为“ 无可用数据”。

更新

使用MWS API C#客户端库通过Sellercentral.amazon.com网站手动请求的最新解决方法代码示例_GET_FBA_RECONCILIATION_REPORT_DATA_报告:

    //private string ACCESS_KEY_ID => ...
    //private string SECRET_ACCESS_KEY =>  ...
    //private string MERCHANT_ID => ...
    //private string MAKETPLACE_ID => ...
    //private string APPLICATION_NAME => ...
    //private string APPLICATION_VERSION => ...
    public void DownloadMostRecentFBAInventoryReconciliationReport(string downloadedReportFullPath)
    {
        string reportId = "";
        string reportType = "_GET_FBA_RECONCILIATION_REPORT_DATA_";

        var config = new MarketplaceWebService.MarketplaceWebServiceConfig();
        config.ServiceURL = "https://mws.amazonservices.com";
        config.SetUserAgentHeader(APPLICATION_NAME, APPLICATION_VERSION, "C#");
        var service = new MarketplaceWebService.MarketplaceWebServiceClient(ACCESS_KEY_ID, SECRET_ACCESS_KEY, config);

        // find most recent report id for '_GET_FBA_RECONCILIATION_REPORT_DATA_' report type
        {
            var request = new MarketplaceWebService.Model.GetReportRequestListRequest();
            request.Merchant = MERCHANT_ID;
            request.ReportTypeList = new MarketplaceWebService.Model.TypeList();
            request.ReportTypeList.Type.Add(reportType);

            var response = service.GetReportRequestList(request);
            foreach (MarketplaceWebService.Model.ReportRequestInfo info in response.GetReportRequestListResult.ReportRequestInfo)
            {
                if (!info.ReportProcessingStatus.Equals("_DONE_")) continue;
                reportId = info.GeneratedReportId;
                break;
            }
        }

        // if most recent reportId found - download report's (.csv) data file into {{ downloadedReportFullPath }}
        if (!string.IsNullOrEmpty(reportId))
        {
            var request = new MarketplaceWebService.Model.GetReportRequest();
            request.Merchant = MERCHANT_ID;
            request.ReportId = reportId;
            request.Report = File.Open(downloadedReportFullPath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            var response = service.GetReport(request);
        }
    }

0 个答案:

没有答案