Jump to content

Getting order information from Amazon Merchant Services


This topic is 2391 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi gang,

   I'm an Amazon merchant, selling goods over Amazon Merchant Services.   Right now, I copy/paste order infomation from the Amazon web page into Filemaker.  

Is there any Filemaker support to capture my orders from Amazon and put them into a Filemaker database?

Thanks!

-Cliff

Link to comment
Share on other sites

Hi Cliff,

I have not checked with Amazon but I would highly suspect that they can provide vendors with ability to export their sales which you could then script to import into FileMaker.   It might be easier than trying to scrape a webpage.  Amazon is really good about assisting vendors, from what I've been told, so I would start by asking them.

Link to comment
Share on other sites

I would suspect they can provide an API from which you can import directly. However, a Google search for "Amazon Merchant Services API" does not find anything that looks useful - and, actually, neither does "Amazon Merchant Services" alone.

Link to comment
Share on other sites

  • 3 weeks later...

Sigh - no luck whatsoever.  

Amazon Merchant Services is widely used and heavily documented.   But there is *Nothing* about a Filemaker interface.  Lots of Python interfaces. 

Worse, accessing the Amazon Merchant Services is possible using cUrl, but everything needs to be signed with SHA 256 HMAC ... gawd.  

Link to comment
Share on other sites

  • 4 weeks later...

OK - I did it myself.  Over a couple weekends of spare time, I wrote a few dozen scripts that interface between Filemaker and the Amazon Marketplace Web Service API.

 Sad to say, this is non-trivial.  Amazon's documentation is poor: there are a surprising number of mistakes, misspellings, and obsolete/outdated sections.  The one bright spot is the Amazon MWS Scratchpad, which provides a direct sandbox to allow testing different calls.

Most of the documentation and online help is aimed at PHP & Java & Python developers; it's not too difficult to map this into Filemaker land.  I wrote scripts to gather my orders from Amazon Market Place, and to send confirmations to buyers.  

 

Like most API's, there are many gotcha's.  Here's a few hints, mainly to save time for others in my position.

1)  A simple Filemaker WebViewer is *not* going to work, unless you do screen-scrapes from the Amazon MWS Scratchpad.

2) I used cURL to communicate with Amazon Web Service via  POST.  The information to be POSTed is the Amazon parameter string (which includes the hashed signature).  The Monkeybread Software Filemaker functions (www.mbsplugins.eu) are just the ticket.

3) The outgoing information must be signed with a SHA256 hash.  Again, this is available in the Monkeybread software functions.   Use MBS("Hash.SHA256HMAC"; g_AWS_Secret_Key; g_AWS_Text_to_Sign_With_NewLines_Replaced; 1)

4) Getting the correct SHA256 signature requires very strict observance of line-feeds ... carriage return / linefeeds in OS X and Filemaker will cause a bad signature.  Before making the SHA256 hash, do a complete replace so as to generate only Unix-style line-feeds.   Within the "canonical parameter list" there aren't any linefeeds (but there are linefeeds before that list)

5) The Amazon API demands ISO-8601 timestamps, based on UTC.  Filemaker timestamps are not ISO-8601, but there are several custom functions to generate these.  The Filemaker function, get(CurrentTimeUTCMilliseconds), is very useful, but its result must be converted into ISO-8601.  Notice that Amazon UTC Timestamps have a trailing "Z" ... when I did not include this, the signatures failed.

6)  The Amazon API must have url encoded strings (UTF-8).  So the output from the SHA256 hash must be converted to URL encoding -- again, the Monkeybread software comes through (use MBS function  Text.EncodeToURL)

7) The Amazon "canonical parameter list" must be in alphabetical order, and must include all of the items listed in the documentation.  

8) Errors from Amazon throttling show up in the stock XML return, but check for other errors returned by the cURL debug response.  At minimum, search through both responses by doing a filemaker PatternCount (g_returned_data; "ERROR")

9) When you're notified of a new Amazon order, you must make two (or more) cURL calls to Amazon MWS:

     1) first, do cURL request to "list orders", which will return all the Amazon Order Numbers (and some other info) for each order since a given date/time.

     2) Then, knowing an order number, you do another cURL to get all the details for a given order.  Repeat this step for every new Amazon order number.

    Each of these calls requires your Amazon Seller_ID, Marketplace_ID, Developer_Account_Number,_Access_Key_ID, and your AWS_Secret_Key. Each also requires a SHA-256 hash of all this information along with the "canonical parameter list" 

If anyone wants my actual scripts, drop a note to me (At this moment, my scripts do the all-important  /orders /list orders and /get order.  I'm almost finished writing a /feeds filemaker API to send confirmations.  I probably won't build scripts to manage inventory or subscriptions, but once you've built a framework for the scripts, it's not difficult to expand to more functionality)

       Best of luck all around,   -Cliff Stoll

  • Like 3
Link to comment
Share on other sites

  • 1 year later...
  • Newbies

 

On 21/09/2016 at 10:48 AM, CliffS said:

OK - I did it myself.  Over a couple weekends of spare time, I wrote a few dozen scripts that interface between Filemaker and the Amazon Marketplace Web Service API.

 Sad to say, this is non-trivial.  Amazon's documentation is poor: there are a surprising number of mistakes, misspellings, and obsolete/outdated sections.  The one bright spot is the Amazon MWS Scratchpad, which provides a direct sandbox to allow testing different calls.

Most of the documentation and online help is aimed at PHP & Java & Python developers; it's not too difficult to map this into Filemaker land.  I wrote scripts to gather my orders from Amazon Market Place, and to send confirmations to buyers.  

 

Like most API's, there are many gotcha's.  Here's a few hints, mainly to save time for others in my position.

1)  A simple Filemaker WebViewer is *not* going to work, unless you do screen-scrapes from the Amazon MWS Scratchpad.

2) I used cURL to communicate with Amazon Web Service via  POST.  The information to be POSTed is the Amazon parameter string (which includes the hashed signature).  The Monkeybread Software Filemaker functions (www.mbsplugins.eu) are just the ticket.

3) The outgoing information must be signed with a SHA256 hash.  Again, this is available in the Monkeybread software functions.   Use MBS("Hash.SHA256HMAC"; g_AWS_Secret_Key; g_AWS_Text_to_Sign_With_NewLines_Replaced; 1)

4) Getting the correct SHA256 signature requires very strict observance of line-feeds ... carriage return / linefeeds in OS X and Filemaker will cause a bad signature.  Before making the SHA256 hash, do a complete replace so as to generate only Unix-style line-feeds.   Within the "canonical parameter list" there aren't any linefeeds (but there are linefeeds before that list)

5) The Amazon API demands ISO-8601 timestamps, based on UTC.  Filemaker timestamps are not ISO-8601, but there are several custom functions to generate these.  The Filemaker function, get(CurrentTimeUTCMilliseconds), is very useful, but its result must be converted into ISO-8601.  Notice that Amazon UTC Timestamps have a trailing "Z" ... when I did not include this, the signatures failed.

6)  The Amazon API must have url encoded strings (UTF-8).  So the output from the SHA256 hash must be converted to URL encoding -- again, the Monkeybread software comes through (use MBS function  Text.EncodeToURL)

7) The Amazon "canonical parameter list" must be in alphabetical order, and must include all of the items listed in the documentation.  

8) Errors from Amazon throttling show up in the stock XML return, but check for other errors returned by the cURL debug response.  At minimum, search through both responses by doing a filemaker PatternCount (g_returned_data; "ERROR")

9) When you're notified of a new Amazon order, you must make two (or more) cURL calls to Amazon MWS:

     1) first, do cURL request to "list orders", which will return all the Amazon Order Numbers (and some other info) for each order since a given date/time.

     2) Then, knowing an order number, you do another cURL to get all the details for a given order.  Repeat this step for every new Amazon order number.

    Each of these calls requires your Amazon Seller_ID, Marketplace_ID, Developer_Account_Number,_Access_Key_ID, and your AWS_Secret_Key. Each also requires a SHA-256 hash of all this information along with the "canonical parameter list" 

If anyone wants my actual scripts, drop a note to me (At this moment, my scripts do the all-important  /orders /list orders and /get order.  I'm almost finished writing a /feeds filemaker API to send confirmations.  I probably won't build scripts to manage inventory or subscriptions, but once you've built a framework for the scripts, it's not difficult to expand to more functionality)

       Best of luck all around,   -Cliff Stoll

I am working on the same. Can you share the basic script for just fetching the orders from MWS account through curl requests? 

Link to comment
Share on other sites

This topic is 2391 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.