I need to create an Amazon MWS POST Request in MS VBA.
I started by testing our credentials in Amazon MWS Scratchpad. They worked fine.
Then I created the code below from the Request Details tab of Scratchpad.
When I execute the procedure below the response is:
<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
<Error>
<Type>Sender</Type>
<Code>InvalidParameterValue</Code>
<Message>Either Action or Operation query parameter must be present.</Message>
</Error>
<RequestID>d75ae9c1-2df5-46f9-8638-df3a179117c3</RequestID>
</ErrorResponse>
I’m stuck trying to interpret the error code received. Just not sure what I’m missing.
Any help would be greatly appreciated.
Private Sub AmazonPostRequest()
Dim httpReq As MSXML2.XMLHTTP60
Dim XMLdoc As MSXML2.DOMDocument60
Dim POSTdata As String
POSTdata = _
"https://mws.amazonservices.com/Products/2011-10-01?" & _
"&Action=GetMatchingProduct" & _
"ASINList.ASIN.1=BXXXXXXXXB" & _
"&AWSAccessKeyId=AXXXXXXXXXXXXXXXXXXA" & _
"&MWSAuthToken=AXXXXXXXXXXX9" & _
"&MarketplaceId=AXXXXXXXXXXXR" & _
"&SellerId=AXXXXXXXXXXX9" & _
"&SignatureMethod=HmacSHA256" & _
"&SignatureVersion=2" & _
"&Timestamp=2019-04-19T19%3A25%3A08Z" & _
"&Version=2011-10-01" & _
"&Signature=jXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXD"
Set httpReq = New MSXML2.XMLHTTP60
With httpReq
.Open "POST", "https://mws.amazonservices.com/Products/2011-10-01", False
.setRequestHeader "Host", "mws.amazonservices.com"
.setRequestHeader "user-agent", "AmazonTest"
.setRequestHeader "Content-Type", "text/xml"
.send POSTdata
'Put XML response in a DOMDocument for parsing
Set XMLdoc = .responseXML
MsgBox XMLdoc.XML
End With
End Sub
This argument should have an ampersand prefixed?