I am trying to use Amazon's new Selling Partner API to access a direct fulfillment / vendor central account. I have followed the documentation to the best of my ability but I can't get a simple po request call to work. Here is all of the elements from my request. I am at a loss what if any part is actually wrong. I don't know of any way of testing all the elements for validity like you can with the Amazon MWS scratchpad.
canonical request
GET
/vendor/directFulfillment/orders/v1/purchaseOrders
createdAfter=2020-10-05T23%3A00%3A00-08%3A00&createdBefore=2020-10-09T23%3A00%3A00-08%3A00
host:sellingpartnerapi-na.amazon.com
user-agent:My, Selling, Tool/1.0, (Language=C#.NET; Platform=Windows/10)
x-amz-access-token:Atza|IwEBIG0G7EXAMPLE
x-amz-date:20201014T193028Z
host;user-agent;x-amz-access-token;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
string to sign
AWS4-HMAC-SHA256
20201014T193352Z
20201014/us-east-1/execute-api/aws4_request
d8efa99344ee27ae5505888ac5069f78734af9a95637485396274f8e773e2784
credential scope
20201014/us-east-1/execute-api/aws4_request
authorization header
AWS4-HMAC-SHA256 Credential=AKIAUEXAMPLE/20201014/us-east-1/execute-api/aws4_request, SignedHeaders=host;user-agent;x-amz-access-token;x-amz-date, Signature=cab976c4d1d2546328e19ff2314f888d0c4b25da4d36f66e53a6614c37b92dff
Here is the error response we are getting.
{Connection: keep-alivex-amzn-RequestId: 728bd01f-32ec-49d3-b845-558f4970014ax-amzn-ErrorType: InvalidSignatureExceptionx-amz-apigw-id: Uaxq-G6MoAMF6Cg=Date: Wed, 14 Oct 2020 20:44:02 GMT}
The error response showing your signature is not right. Also, you can test easier API to test the connection with your AWS.
Try this one, product-pricing-api, https://github.com/amzn/selling-partner-api-docs/blob/main/references/product-pricing-api/productPricingV0.md
Request request = new Request.Builder()
.url("https://sellingpartnerapi-na.amazon.com/products/pricing/v0/price?MarketplaceId=A2EUQ1WTGCTBG2&Skus="+sku+"&ItemType=Sku")
.method("GET", null)
.addHeader("x-amz-access-token","your token")
.build();
AWSSigV4Signer awsSigV4Signer = new AWSSigV4Signer(awsAuthenticationCredentials,awsAuthenticationCredentialsProvider);
request = awsSigV4Signer.sign(request);
x-amz-access-token: Atza|...
X-Amz-Security-Token: FwoGZX...
Host:sellingpartnerapi-na.amazon.com
X-Amz-Date:20201014T193352Z
Authorization: AWS4-HMAC-SHA256 Credential=AKIAUEXAMPLE/20201014/us-east-1/execute-api/aws4_request, SignedHeaders=host;x-amz-access-token;x-amz-date;x-amz-security-token, Signature= {your signature}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With