In this blog post, I will try to cover how to find out if the post sent to Amazon is success or not.   We used C# with Amazon SDK leveraging AWS.

Scenario :

In our earlier blog post we covered how to post available qty to Amazon using AWS.  Refer to earlier blogpost as to how project is setup and other required details.

After sending the post to Amazon, we need to find out if it went through fine or were there any failures.

Below is the code snippet which shows how to submit the feed. But in this blog, we need to find results of the feed submitted. So the yellow colored lines below is what is required.



                SubmitFeedRequest feedRequest = new SubmitFeedRequest();

                feedRequest.Merchant = _merchantId;

                feedRequest.FeedContent = File.Open(Path, FileMode.Open, FileAccess.Read);

                feedRequest.ContentMD5 = CalculateContentMD5(feedRequest.FeedContent);

                MktWebServiceConfig config = new MktWebServiceConfig();

                config.ServiceURL = _serviceUrl;

                config.SetUserAgentHeader(“POSTQTY”, “1.0”, “C Sharp”);

                feedRequest.FeedContent.Position = 0;

                feedRequest.FeedType = “_POST_INVENTORY_AVAILABILITY_DATA_”;

                MktWebClient client = new MktWebClient (_accessKeyId, _secretAccessKey, config);

                SubmitFeedResponse feedResponse = client.SubmitFeed(feedRequest);

                FeedSubmissionInfo feedInfo = feedResponse.SubmitFeedResult.FeedSubmissionInfo;

                feedId = feedInfo.FeedSubmissionId.ToString();


            catch (Exception ex)


                customLog (ex.Message + “\n” + ex.Source + “\n” + ex.Data + “\n” + ex.StackTrace);


Once we have the feedId, we need to find out what happened.

Depending on the volume of data that is sent using AWS, we need to plan when to check the feed results. Typically, about 4 mins of wait time is required here. So, within C# application incorporate code to pause for 5 mins (this code is not shown here).

string fileToReceive = “c:\aws\response.txt”;

string responseReceived= “”;

responseReceived = DownloadFeedSubmissionResult(client, feedId, fileToReceive);

responseReceived = responseReceived + “\n\n” + findResponseHasError(fileToReceiv, feedId);


// findResponseHasError function checks the amazon file received. First find if the feedId is matching and then look for keywords containing error or warnings. If found, store to an array and print. This function is not shown here as it is more of typical c# string/file manipulations.

static string DownloadFeedSubmissionResult(MarketplaceWebServiceClient client, String feedInfoId,String fileToReceive, string _merchantId)


            StringBuilder str_FeedResult = new StringBuilder();



                GetFeedSubmissionResultRequest request = new GetFeedSubmissionResultRequest();

                request.Merchant = _merchantId;

                request.FeedSubmissionId = feedInfoId;

                using (FileStream stream = new FileStream(fileToReceive, FileMode.OpenOrCreate, FileAccess.ReadWrite))


                    request.FeedSubmissionResult = stream;

                    GetFeedSubmissionResultResponse response = client.GetFeedSubmissionResult(request);




            catch (MarketplaceWebServiceException ex)


                str_FeedResult.Append(“Caught Exception: DownloadFeedSubmissionResult :” + ex.Message);

                str_FeedResult.Append(“Response Status Code: ” + ex.StatusCode);

                str_FeedResult.Append(“Error Code: ” + ex.ErrorCode);

                str_FeedResult.Append(“Error Type: ” + ex.ErrorType);

                str_FeedResult.Append(“Request ID: ” + ex.RequestId);

                str_FeedResult.Append(“XML: ” + ex.XML);

                str_FeedResult.Append(“ResponseHeaderMetadata: ” + ex.ResponseHeaderMetadata);


            return str_FeedResult.ToString();


Feel free to contact us for any questions.