img
scroll
#

Posting data to Amazon have to be made in a different way

Uk Ru En
Article
#0002

Let's update an order's tracking number for example

At first it should be noticed, that your posting requests have to be signed with the Signature parameter, see Amazon Marketplace Web Service API Connection Guidelines
For sending data to Amazon we need to use the Feed API. All the requests for this API category have to be signed by one more additional signature. The signature will depend on a file we will send in the body of POST-request. Let's assume there is the order with id "A" in the Amazon database. This order contains one product with id "B". We want to set the order's tracking number to "C" for delivery service "D" and delivery method "E".

Posting data to Amazon have to be made in a different way

This way our file will look like this:

<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
    <AmazonEnvelope xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instancet\">;
         <Header>
              <DocumentVersion>1.01</DocumentVersion>
              <MerchantIdentifier>{{ SellerId }}</MerchantIdentifier>
         </Header>
         <MessageType>OrderFulfillment</MessageType>
         <Message>
              <MessageID>1</MessageID>
              <OrderFulfillment>
                   <AmazonOrderID>{{ A }}</AmazonOrderID>
                   <FulfillmentDate>{{ FulfillmentDate }}</FulfillmentDate>
                   <FulfillmentData>
                        <CarrierName>{{ D }}</CarrierName>
                        <ShippingMethod>{{ E }}</ShippingMethod>
                        <ShipperTrackingNumber>{{ C }}</ShipperTrackingNumber>
                   </FulfillmentData>
                   <Item>
                        <AmazonOrderItemCode>{{ B }}</AmazonOrderItemCode>
                         <Quantity>1</Quantity>
                   </Item>
              </OrderFulfillment>
         </Message>
</AmazonEnvelope>


Besides above-mentioned parameters we can see parameters SellerId and FulfillmentDate. SellerId - is unique Amazon user identifier and was considered in part one of the article. FulfillmentDate - is fullfilment date in "ISO 8601" format. Now let's make the signature. We have to encode the file content using md5 method, then encode the result string using base64 method. The result we have to pass as the value of "Content-MD5" header. "D" and "E" parameters may have "USPS" and "USPS First Class" values respectively.

Because the request body contains the file, we have to send "Action" and "FeedType" parameters in a query string, despite the request HTTP-method is POST. Now we have to set "Action" to "SubmitFeed" and "FeedType" to "_POST_ORDER_FULFILLMENT_DATA_". To avoid file sending problems set "Content-Type" header to "text/xml".

Because files can be huge, up to 2Gb, the Amazon service doesn't return the result of a particular file processing with response, but returns the registered feed Id.

A response could contain such text, for example:

<?xml version="1.0"?>
<SubmitFeedResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
    <SubmitFeedResult>
        <FeedSubmissionInfo>
            <FeedSubmissionId>{{ FeedSubmissionId }}</FeedSubmissionId>
            <FeedType>_POST_ORDER_FULFILLMENT_DATA_</FeedType>
            <SubmittedDate>{{ SubmittedDate }}</SubmittedDate>
            <FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
        </FeedSubmissionInfo>
    </SubmitFeedResult>
    <ResponseMetadata>
        <RequestId>{{ RequestId }}</RequestId>
    </ResponseMetadata>
</SubmitFeedResponse>


where "FeedSubmissionId" - the feed Id, you can use it later to check the result of file processing, SubmittedDate - feed registration date, RequestId - just response Id, that every Amazon response has.

After some time, but if the file is not huge we can do it by just sending the next request, we will be able to check the feed status, using GET-request with "Action" set to "GetFeedSubmissionResult" and "FeedSubmissionId" with the value of "FeedSubmissionId" from the previous response.

All the rest feeds uploading may be processed in the same way, one just have to know all the needed Ids of the Amazon entities, like above-mentioned order Id "A" and product Id "B". You can get them in Amazon website account section or using API, as was mentioned in part one of the article.

Blog
#0002
Articles You May Also Be Interested In
Mobile applications API
Mobile applications API development tips. It is a common knowledge that websites owners want to provide the same functionality of the sites in the form of mobile applications.
Asabix Wins Clutch Award for Top Developer in Ukraine
Asabix Wins Clutch Award for Top Developer in Ukraine
Today, there’s about 200 million active websites and 1.8 billion web applications. These numbers continue to grow each day, adding more to the clutter. The only way to stand out from the crowd these days is through innovation and creativity—and that’s where we come in!
Admitad API Connection Experience
Admitad API Connection Experience
Admitad is a global affiliate network with a large selection of affiliate programs, high rates, express payments, and many tools.
Implementing a Connection to the Payoneer API
Connection to the Payoneer API payment system. Main connection environments. User’s registration/authorization through the provided link, list of users
Contact Us
#0013
Ready to Start? Let Us Know!
Address:

Ukraine, Zhytomyr
Vitruka Street, 9V

M-F, 9am — 7pm

Address:

Poland, Warsaw, 00-842
Łucka street 15/204

M - F, 9am - 7pm

Contact Us
#0000
Have a Question?
Describe your problem, fill the form below, and our staff will help you!
Required field
Required field
Required field
Required field