Using MWS API to get FBA Inventory Reconciliation report data

932 views Asked by At

I'm looking how to query undocumented MWS API for Inventory Reconciliation report (List of api names for seller central fulfillment reports ) using C# Client Library or any other client libraries, or using Amazon MWS Scratchpad - for the latter the rules to set the values of the fields MarketplaceIdList.Id.1, StartDate, EndDate and ReportOptions are unclear for me: I'm setting the first three fields as I usually do for the other report types and I leave the ReportOptions field empty - and the MWS API call via C# library for _GET_FBA_RECONCILIATION_REPORT_DATA_ report is accepted but it finally gets 'No Data Available' status.

UPDATE

Sample workaround code to download manually requested via sellercentral.amazon.com web site most recent _GET_FBA_RECONCILIATION_REPORT_DATA_ report using MWS API C# Client library:

    //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

There are 0 answers