Issue with stock update on amazon with mws - amazon-mws

We are using the following details for updating the quantity of a product in amazon. Wile using scratch pad, option Feeds->SubmitFeed
Set the required parameters and pass the following XML
<?xml version="1.0" encoding="utf-8" ?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>$merchantID</MerchantIdentifier>
</Header>
<MessageType>Inventory</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Inventory>
<SKU>$SKU</SKU>
<Quantity>8</Quantity>
</Inventory>
</Message>
</AmazonEnvelope>
feed type : _POST_INVENTORY_AVAILABILITY_DATA_
we are getting in response for the same - submissionid. I know it takes sometime to update. But i waited and waited .. 4 atleast 15 hrs (not minutes) but it still was in process and the quantity was never updated.
Am getting in the following response
<?xml version="1.0"?>
<SubmitFeedResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<SubmitFeedResult>
<FeedSubmissionInfo>
<FeedSubmissionId>6791310806</FeedSubmissionId>
<FeedType>_POST_INVENTORY_AVAILABILITY_DATA_</FeedType>
<SubmittedDate>2013-03-21T19:48:37+00:00</SubmittedDate>
<FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
</FeedSubmissionInfo>
</SubmitFeedResult>
<ResponseMetadata>
<RequestId>fd07bf18-4f6a-4786-bdf9-9d4db50956d0</RequestId>
</ResponseMetadata>
</SubmitFeedResponse>
and getting in following response on checking the status of the feed
<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<Error>
<Type>Sender</Type>
<Code>FeedProcessingResultNotReady</Code>
<Message>Feed Submission Result is not ready for Feed Submission Id: 6791310806</Message>
<Detail/>
</Error>
<RequestID>2c86128d-b53a-4fc3-80d1-6b41b53a8977</RequestID>
</ErrorResponse>
Can any1 guide me.. where did i go wrong .. in here? or if there is any better way to look on for the same.

The time it seems to be taking isn't normal. Submitted feeds usually switch to _IN_PROGRESS_ within a few minutes and then take another few minutes to complete, when the status switches to _DONE_. Short feeds like your example feed should take less than a minute to process.
In the past, I've seen one feed upload blocking another though. It seems that sometimes the MWS won't start processing one feed until a previous feed of the same user has gone trough (or for that matter: failed). Please check if you have other request that might block yours (GetFeedSubmissionList)
Apart from this, the answers you are getting from Amazon MWS are perfectly normal. Your feed was accepted and put into the processing queue. The queue status was set to _SUBMITTED_, and as long as it hasn't switched to DONE, you will get the FeedProcessingResultNotReady answer you were seeing.

Related

How to cancel ONE item using amazon mws order adjustment feed?

I've been trying to cancel single item from an amazon order using their order adjustment feed, but every time I submit request I get:
ERROR 18028: The data you submitted with this item is incomplete or invalid. Please resubmit the item with all required fields completed with valid data.
I've used this xml in my requests:
<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>XXXXXXXXX</MerchantIdentifier>
</Header>
<MessageType>OrderAdjustment</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<OrderAdjustment>
<AmazonOrderID>305-XXXXXXX-XXXXXXX</AmazonOrderID>
<ActionType>Cancel</ActionType>
<AdjustedItem>
<AmazonOrderItemCode>209XXXXXXXXXXX</AmazonOrderItemCode>
<AdjustmentReason>NoInventory</AdjustmentReason>
<QuantityCancelled>1</QuantityCancelled>
</AdjustedItem>
</OrderAdjustment>
</Message>
</AmazonEnvelope>
I have double checked my xml and it seems to be valid according to amazon's xsd schema.
I would appreciate if someone with similar problem could share their experience.
TLDR: Try setting the ActionType to Refund instead of Cancel.
This concerns merchant that do their own fulfillment.
Two scenarios come to mind, an order with:
two items, each with quantity 1
one item with quantity 2
Logically, a partial cancel involves fulfilling one item and canceling the second.
Since the MWS API does not have a single operation for a partial cancel, the application has to first fulfill the second item and then refund it.
That means first sending an OrderFulfillment message for the second item and then sending an OrderAdjustment for it.
I've found that the ActionType of Cancel gives the same error message as seen in the original post while a value of Refund is successfully processed.

Posting hazardous materials information to Amazon MWS

We are using MWS service to create/update items on Amazon marketplace. Everything is working fine except we are not able to send hazardous item info for an item through XML.
Which XML fields should we use for hazardous materials information?
Example Feed:
<?xml version="1.0" ?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance" xsi:noNamespaceSchemaLocation="amzn
-
envelop
e.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_SELLER_354577</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>true</PurgeAndReplace>
<Message>
<MessageID>1</MessageID>
<Op
erationType>Update</OperationType>
<Product>
<SKU>1Z
-
500ABR
-
FLAT</SKU>
<ProductTaxCode>A_GEN_TAX</ProductTaxCode>
<LaunchDate>2005
-
07
-
26T00:00:01</LaunchDate>
<DescriptionData>
<Title>Lyric 500 tc Queen Flat Sheet, Ivory</Title>
<Brand>Peaco
ck Alley</Brand>
<Description>Lyric sheeting by Peacock Alley is the epitome of simple and classic</Description>
<BulletPoint>made in Italy</BulletPoint>
<BulletPoint>500 thr
ead count</BulletPoint>
<BulletPoint>plain weave (percale)</BulletPoint>
<BulletPoint>100% Egyptian cotton</BulletPoint>
<Manufacturer>Peacock Alley</Manufacturer>
<SearchTerms>bedding</SearchTerms>
<SearchTerms>Sheets</SearchTerms>
<Item
Type>flat
-
sheets</ItemType>
<IsGiftWrapAvailable>false</IsGiftWrapAvailable>
<IsGiftMessageAvailable>false</IsGiftMessageAvailable>
<RecommendedBrowseNode>60583031</RecommendedBrowseNode>
<RecommendedBrowseNode>60576021<
/RecommendedBrowseNode>
</DescriptionData>
<ProductData>
<Home>
<Parentage>variation
-
parent</Parentage>
<VariationData>
<VariationTheme>Size
-
Color</VariationTheme>
</VariationData>
<Material>cotton</Material>
<
ThreadCount>500</ThreadCount>
</Home>
</ProductData>
</Product>
</Message>
<Message>
</AmazonEnvelope>
There are a few fields in the XSD that deal with hazardous materials
There is the <EUcompliance> tag, but according to the XSD, that could only be used instead of <Home> which does not make any sense to me. For details look at Products.xsd and EUcompliance.xsd
There are <HazmatItem>s in <FBA> and <ToysBaby> but they share the same fate as the above. For details look at amzn-base.xsd for its definition and FBA.xsd and ToysBaby for its use.
I have no clue why neither is valid alongside other product types, but hey, that's what their XSDs say, and it's not the first time I'm puzzled what the schema designers at Amazon were thinking... so you're left with
Put it in <OtherItemAttributes> which is valid for all product types. It would go between </ItemType> and <IsGiftWrapAvailable>. For details look at products.xsd
I don't know why you'd want to include hazmat information in the feed, but that's where I'd put it.
(BTW, you have an extra tag at the end which shouldn't be there)

What causes the InvalidEntity exception in the SFDC bulk api?

When creating a new bulk job through the API, I am getting an InvalidEntity as an exception code which isn't in SFDC's docs (pdf)
I'm making the following request
https://na13-api.salesforce.com/services/async/24.0/job
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>query</operation>
<object>Campaign</object>
<concurrencyMode>Parallel</concurrencyMode>
<contentType>CSV</contentType>
</jobInfo>
And I get this response:
<?xml version="1.0" encoding="UTF-8"?><error
xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<exceptionCode>InvalidEntity</exceptionCode>
<exceptionMessage>Entity 'Campaign' is not supported by the Bulk API.</exceptionMessage>
</error>
I've excluded the headers but I do have accept & content encoding specified as gzip and the content is gzipped when it is sent and received.
The requests work correctly for
Lead
Contact
Opportunity
Task
Event
OpportunityContactRole
Account
CampaignMember
Note
Profile
RecordType
User
I only get the exception shown above for:
Campaign
UserLicense
OpportunityStage
OpportunityHistory
LeadHistory
I'm only using the bulk api to download csv's out of salesforce and I've only tried the above entities because I don't need any others.
It has been a very long time, but I think you can get this exception if one of your foreign key relationships is incorrect.

RequestThrottling issue in Amazon MWS API

I am testing API Sample of Amazon MWS API in C# for submit feeds however after setting AWS Secret key , access key etc. in code i am getting error of RequestThrottled , so there is details what is that but could not find any code sample how to resolved that.
I would like to upload feed.xml to amazon seller account
<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>true</PurgeAndReplace>
<Message>
<MessageID>1</MessageID>
<OperationType>Insert</OperationType>
<Product>
<SKU>56789</SKU>
<StandardProductID>
<Type>ASIN</Type>
<Value>B0EXAMPLEG</Value>
</StandardProductID>
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
<DescriptionData>
<Title>Example Product Title</Title>
<Brand>Example Product Brand</Brand>
<Description>This is an example product description.</Description>
<BulletPoint>Example Bullet Point 1</BulletPoint>
<BulletPoint>Example Bullet Point 2</BulletPoint>
<MSRP currency="USD">25.19</MSRP>
<Manufacturer>Example Product Manufacturer</Manufacturer>
<ItemType>example-item-type</ItemType>
</DescriptionData>
<ProductData>
<Health>
<ProductType>
<HealthMisc>
<Ingredients>Example Ingredients</Ingredients>
<Directions>Example Directions</Directions>
</HealthMisc>
</ProductType>
</Health>
</ProductData>
</Product>
</Message>
</AmazonEnvelope>
Error getting as per below
Caught Exception: Request from SubmitFeed:AKIAJI4PSK4HXY6UCNMA;A2DNAGZJ1EWQLW is
throttled.
Response Status Code: ServiceUnavailable
Error Code: RequestThrottled
Error Type: Sender
Request ID: fc59c802-04da-4dd3-89a8-db5f525cac39
XML: <ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/"><Error><Typ
e>Sender</Type><Code>RequestThrottled</Code><Message>Request from SubmitFeed:AKI
AJI4PSK4HXY6UCNMA;A2DNAGZJ1EWQLW is throttled.</Message><Detail>System.Object</D
etail></Error><RequestId>fc59c802-04da-4dd3-89a8-db5f525cac39</RequestId></Error
Response>
How can this be resolved?
As per Amazon's API reference the SubmitFeed operation has a maximum request quota of 15 and a restore rate of a request every 2 minutes. This means that you're allowed to make calls to this operation in burst of 15, but after this you're throttled for 2 minutes, until Amazon allows you to make another request.
You can find this better explained in their developer guide where they describe better how they make use of the leaky bucket algorithm.
Probably there isn't anything wrong with your feed, but because you made too many requests (probably more than 15) you got throttled. My advice is to build your code in such a way that you take into consideration Amazon throttlening and have a back-off algorithm when you're being throttled (like come back after a "restore rate" period, specific to the type of call you're doing). Also, keep in mind that another limitation MWS has is of 10000 requests per hour across all type of calls.

Google App Engine time out?

In a Google App Engine app I used the following lines to read a page from a site :
String Url="http://...",line,Result="";
URL url=new URL(Url+"?r="+System.currentTimeMillis());
BufferedReader reader=new BufferedReader(new InputStreamReader(url.openStream()));
while ((line=reader.readLine())!=null) { Result+=line+"\n"; }
reader.close();
But I got the following error :
Uncaught exception from servlet
com.google.apphosting.api.DeadlineExceededException: This request (f5e2889605d27d42) started at 2011/09/07 03:20:41.458 UTC and was still executing at 2011/09/07 03:21:30.888 UTC.
at sun.misc.Unsafe.park(Native Method)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1326)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:276)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:82)
at com.google.appengine.tools.development.TimedFuture.get(TimedFuture.java:55)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:69)
at com.google.apphosting.runtime.ApiProxyImpl.doSyncCall(ApiProxyImpl.java:177)
at com.google.apphosting.runtime.ApiProxyImpl.access$000(ApiProxyImpl.java:56)
at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:150)
at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:148)
at java.security.AccessController.doPrivileged(Native Method)
Seems it took longer than it would like to wait, what can I do if that site is slow ?
A DeadlineExceededException is thrown when your code, handling the request to your web application takes over 30 seconds to process. Presumably your code is taking a while to process because of the length of time it had to wait to receive data from some other site.
You can create a task on a task queue to fetch and process that data, and change your web request/response flow to reply with progress on your task.
If your code is running inside a request handler, then by default there is an App-Engine-enforced 60 second deadline. You can't change it. See the "Deadlines" row / "automatic scaling" column of the chart on this page under "Scaling types":
https://developers.google.com/appengine/docs/java/modules/
However, this code will be able to run for some hours if you change your module to use "manual scaling" and a "B1"-"B4" instance. Example:
default/src/main/webapp/WEB-INF/appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>myapp</application>
<module>default</module>
<version>1</version>
<threadsafe>true</threadsafe>
<instance-class>B1</instance-class>
<manual-scaling>
<instances>1</instances>
</manual-scaling>
</appengine-web-app>
On this type of instance, your requests will typically not time out for hours. (The documentation claims that the deadline is "indefinite".)

Resources