I am trying to generate and send an HTTP post request to the SubmitFeed API which is part of the feed APIs from amazon MWS.
I keep getting the following error.
HTTP operation failed invoking https://mws.amazonservices.com/?AWSAccessKeyId=AKIAIGGOD6TP2MU3QSIA&Action=SubmitFeed&Merchant=A3EHHQS88SHP31&MWSAuthToken=amzn.mws.4ab2a0a1-9179-fb5a-a755-d3981035aa1b&SignatureVersion=2&Timestamp=2018-09-07T18%3A41%3A31.652Z&Version=2009-01-01&ContentMD5Value=oImnsIniaTslNJPJp9%2FvUw%3D%3D&Signature=OKUMSIF70eh3TkwEmIkSg3izagBOo8wp4ES0q3dgKRg%3D&SignatureMethod=HmacSHA256&FeedType=_POST_PRODUCT_DATA_&PurgeAndReplace= with statusCode: 403
The responsebody has the following message.
<Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message>
I checked my canonical string again and again for each parameter to see all required parameters are present and are url encoded. I have used the sample code for generating signature given in the document.
Here is my canonical string which is used to generate the signature.
I tried the SubmitFeed API on the scratchpad with the same credentials and request body and it goes through. I compared the canonical string on scratchpad and it is similar to my generated canonical string above in terms of parameters and order.
I also checked the debugger for the URL sent by the scratchpad and its similar to my URL above which returns the signature not matching error.
Am I missing something? Why does the amazon generated signature string not match my signature string.