I read a lot of Amazon API documentation and still have not understood what error I am getting, the documentation does not provide useful examples.
I use this to update my inventor:
I read various documents, each of which points to a new service URL, and I'm really confused about this.
config.ServiceURL = "https://mws.amazonservices.co.uk/FulfillmentInventory/2011-10-01"; config.ServiceURL = "https://secure.amazon.co.uk/exec/panama/seller-admin/catalog-upload/modify-only";
My code to start the process and send the request:
String accessKeyId = "#"; String secretAccessKey = "#"; String merchantId = "#"; String marketplaceId = "#"; MemoryStream stream = new MemoryStream(); stream = GenerateInventoryDocument(txtxSku.Text, merchantId, txtQuantity.Text); const string applicationName = "C#"; const string applicationVersion = "4"; MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); MarketplaceWebService.MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config); MarketplaceWebService.Model.SubmitFeedResponse response = new MarketplaceWebService.Model.SubmitFeedResponse(); MarketplaceWebService.Model.SubmitFeedRequest request = new MarketplaceWebService.Model.SubmitFeedRequest(); request.Merchant = merchantId; request.MarketplaceIdList = new MarketplaceWebService.Model.IdList(); request.MarketplaceIdList.Id = new List<string>(new string[] { marketplaceId }); request.FeedContent = stream; request.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(request.FeedContent); request.FeedContent.Position = 0; request.FeedType = "_POST_INVENTORY_AVAILABILITY_DATA_"; SubmitFeedSample.InvokeSubmitFeed(service, request);
Function GenerateInventoryDocument() :
MemoryStream myDocument = new MemoryStream(); string myString; //Add the document header. myString = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"; this.AddStringToStream(ref myString, myDocument); myString = "<AmazonEnvelope xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"; this.AddStringToStream(ref myString, myDocument); myString = "<Header>"; this.AddStringToStream(ref myString, myDocument); myString = "<DocumentVersion>1.01</DocumentVersion>"; this.AddStringToStream(ref myString, myDocument); myString = "<MerchantIdentifier>" + merchantID + "</MerchantIdentifier>"; this.AddStringToStream(ref myString, myDocument); myString = "</Header>"; this.AddStringToStream(ref myString, myDocument); myString = "<MessageType>Inventory</MessageType>"; this.AddStringToStream(ref myString, myDocument); myString = "<Message>"; this.AddStringToStream(ref myString, myDocument); myString = "<MessageID>1</MessageID>"; this.AddStringToStream(ref myString, myDocument); myString = "<OperationType>Update</OperationType>"; this.AddStringToStream(ref myString, myDocument); myString = "<Inventory>"; this.AddStringToStream(ref myString, myDocument); myString = "<SKU>" + sku + "</SKU>"; this.AddStringToStream(ref myString, myDocument); myString = "<FulfillmentLatency>1</FulfillmentLatency>"; this.AddStringToStream(ref myString, myDocument); myString = "<Quantity>" + quantity + "</Quantity>"; this.AddStringToStream(ref myString, myDocument); myString = "</Inventory>"; this.AddStringToStream(ref myString, myDocument); myString = "</Message>"; this.AddStringToStream(ref myString, myDocument); myString = "</AmazonEnvelope>"; this.AddStringToStream(ref myString, myDocument); return myDocument;
When I use this url:
config.ServiceURL = "https://mws.amazonservices.co.uk/FulfillmentInventory/2011-10-01";
I get the following error response:
<ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2011-10-01/"> <Error> <Type>Sender</Type> <Code>NoSuchVersion</Code> <Message>The requested version ( 2010-01-01 ) is not valid.</Message> <Detail/> </Error> <RequestID>f35d1eb0-b8e7-40c0-8394-027619fb0762</RequestID> </ErrorResponse>
And when I use this service URL, which I read in another document:
config.ServiceURL = "https://secure.amazon.co.uk/exec/panama/seller-admin/catalog-upload/modify-only";
I get the following error response:
<BusinessLogicError>CUSTOMER_UNAUTHORIZED</BusinessLogicError>
Please let me know if something is wrong in this code, as I follow the documents completely, and this was the third day I spent on it. Maybe I'm going crazy: D
These are small problems, and I cannot understand them.