-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get signature_v2_auth working for MWS Product API (sorry if this is not the appropriate place to ask) #16
Comments
|
Excellent, thank you for clarifying that. So now I am trying this:
Unfortunately the signature doesn't seem to match. I can't figure out where I went wrong this time based on the documentation. The error I am receiving has changed though. Now I get: "The AWS Access Key Id you provided does not exist in our records." However, I doubled checked and my key is certainly correct. I am googling and checking stack overflow for this error now. Edit: Have tried re-arranging the order of my ultimate URL due to a StackOverflow post indicating that the access key had to come first, also toggled GET / POST as some posts referenced that, no luck with either. |
Can you link to the scratchpad that you're validating against? |
https://mws.amazonservices.com/scratchpad/index.html Sorry it took so long, been extraordinarily busy moving and starting a new job. |
I should add I am using the "products" drop down and "ListMatchingProducts" as the operation. |
Bumping this way-old thread as I've been getting this working (piece by piece) with several MWS API endpoints over the last few weeks, and it would be great to document a more robust way. @turqoisehat it's likely way too late to be helpful, but I have been able to get the ListMatchingProducts endpoint working with the following: signature <- aws.signature::signature_v2_auth(format(Sys.time(),
format = "%Y-%m-%dT%H:%M:%SZ",
usetz = FALSE,
tz = "UTC"),
query_args = list(Action = "ListMatchingProducts",
Version = "2011-10-01",
SellerId = Sys.getenv("MWS_SELLER_ID"),
MarketplaceId = Sys.getenv("MWS_MARKETPLACE_ID"),
Query = "$YOUR_SEARCH_GOES_HERE"),
verb = "POST",
service = "mws.amazonservices.com",
path = stringr::str_c("/", "Products", "/", "2011-10-01"),
key = Sys.getenv("AWS_ACCESS_KEY"),
secret = Sys.getenv("AWS_SECRET_KEY"))
amazon_query <- httr::POST(url = "https://mws.amazonservices.com",
path = signature$Path,
query = list(AWSAccessKeyId = signature$Query$AWSAccessKeyId,
Action = signature$Query$Action,
SellerId = signature$Query$SellerId,
SignatureVersion = signature$Query$SignatureVersion,
Timestamp = signature$Query$Timestamp,
Version = signature$Query$Version,
Signature = signature$Signature,
SignatureMethod = signature$Query$SignatureMethod,
MarketplaceId = signature$Query$MarketplaceId,
Query = signature$Query$Query))
query_results <- amazon_query %>%
httr::content(as = "parsed", type = "text/xml", encoding = "UTF-8") %>%
xml2::as_list() However, endpoints that don't follow exactly this protocol (for example the Orders endpoint, which takes a list of one or more If anyone has used the |
Would love to get signature_v2_auth working for Amazon Product API (MWS, not product advertising).
The query is just a random UPC/EAN I picked to try and get my signatures working. I have set my secret key and access key etc using sys.setenv. I got that datetime straight out of the StringToSign produced by the MWS scratchpad.
I am doing this:
signature_v2_auth(datetime = '2017-06-19T22%3A19%3A12Z', verb = 'POST', service = 'mws.amazonservices.com', path = '/Products/2011-10-1', query_args = '5051892198158')
I am not getting the correct signature as a response. One lead as to what might be wrong, when using the Amazon Product API scratchpad, their example always wants SellerId and MarketplaceId and signature_v2_auth does not seem have any method of passing that information. They also want Action (in my case "ListMatchingProducts" however, there is also no place to pass this argument into signature_v2_auth.
Also, I am using signature_v2_auth because the scratchpad seems to default to version2 when I navigate to the Product API section.
Any help is appreciated. I have also tried to create signatures on my own using RCurl and RDigest, but failed. It would be useful if the documentation had better examples for version 4 as well, I would like to try version 4 but I'm not sure exactly what to put in for each argument such as canonical_headers and request_body.
The text was updated successfully, but these errors were encountered: