2

I tried running Amazon MWS Scratchpad in this site https://mws.amazonservices.com/scratchpad/index.html. And it works fine and I got an xml result

But when I go to request Details and copy the string to sign and all the parameters needed, I POST REQUEST and copy the whole request to postman

What i got is Parameter signature cannot be empty

Any tips why I get a different response? Is there any rest API i can find? Thanks for answers.

draw134
  • 1,053
  • 4
  • 35
  • 84

1 Answers1

1

Scratchpad autogenerates the signature and passes it as a parameter. If you're trying to create your own integration from scratch, you'll need to generate the signature yourself.

This is done by:

  1. hashing the 'string to sign (with the correct timestamp in the exact same format, line breaks included)' w/ a sha-256 hashing algorithm
  2. Digesting that hash to base-64
  3. Then passing that result as the Signature param
  4. NOTE: mws is REALLY finnicky about it's timestamp formats as well, so make sure you compare yours with whatever scratchpad has it formatted as or it will reject your signature

Hope this helps, I remember this being a nightmare when I built out an integration from scratch a few months ago. Took me around 10 hours to get my signature generator right.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Yes. I got it sir. I used `hash_hmac` then `sha256` and then `base64_encode` signature using the key then that worked. It took me 3 days to find a way and this helps. Thanks a lot – draw134 Feb 24 '21 at 02:13