amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
580 stars 730 forks source link

createFeedDocument issue #99

Closed CrashKGM closed 2 years ago

CrashKGM commented 3 years ago

We're migrating over from using MWS to the Seller Partner API - using the c# Amazon.SellingPartnerAPIAA library to sign. We can get orders fine using the new API (/orders/v0/orders) so the signing library and our credentials working fine but for some reason having a hard time doing the createFeedDocument POST call. If we add body as:

restRequest.AddParameter("contentType", "text/tab-separated-values; charset=UTF-8", ParameterType.RequestBody);

get back:

{ "errors": [ { "code": "InvalidInput", "message": "Invalid Input", "details": "" } ] }

but if we change to doing like:

restRequest.AddJsonBody(new { contentType = "text/tab-separated-values; charset=UTF-8" });

we get back:

{ "errors": [ { "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.

The Canonical String for this request should have been 'POST /feeds/2020-09-04/documents MarketplaceIds=ATVPDKIKX0DER host:sellingpartnerapi-na.amazon.com ... The String-to-Sign should have been 'AWS4-HMAC-SHA256 20210502T234822Z 20210502/us-east-1/execute-api/aws4_request d0b76b2f093e11913af74214410ccb43c9d101abb1f6f1ba947c56cd35cc0650' ", "code": "InvalidSignature" } ] }

can't seem to move past this error. Thank you.

ashok-damani commented 3 years ago

Hi, I am also getting same issue. @CrashKGM Were you able to resolve this ?

CrashKGM commented 3 years ago

No, I have not been able to resolve it.

ashok-damani commented 3 years ago

@CrashKGM I have posted a question, may be we can get a response there. https://stackoverflow.com/questions/67671282/c-sharp-amazon-sp-api-createfeeddocument-not-working

parvathm commented 3 years ago

Hi @CrashKGM,

Can you please try like below to add the contentType in body?

request.AddParameter("application/json", "{\n \"contentType\": \"text/tab-separated-values; charset=UTF-8\"\n}", ParameterType.RequestBody);

If this didn't resolve your issue please open a support case so we can help you via a support case.

Thanks, Parvathm, Selling Partner API Developer Support.

CrashKGM commented 3 years ago

Looks like that fixed it. We added like:

restRequest.AddParameter("application/json", "{\n \"contentType\": \"text/tab-separated-values; charset=UTF-8\"\n}", ParameterType.RequestBody);

to our code above. Thanks for your help.

ashok-damani commented 3 years ago

But succeeding call won't work with this way passing content type, it will work in this way:

var contentType = text/tab-separated-values; charset=UTF-8
restRequest.AddParameter("application/json", "{\n \"contentType\": " + contentType + "}", ParameterType.RequestBody);
github-actions[bot] commented 2 years ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.