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

Where is the Sellers API (and AWS credentials provider) in the C# SDK?! #846

Closed antonycartwright closed 1 year ago

antonycartwright commented 3 years ago

Hi everyone,

I've been a software developer for 12 years and I've never seen anything like this API! Especially considering it's from a multi-billion-pound organisation! I realise that it's only a few months old, but still!

Anyway, I've been following this developer guide here: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md

I've registered as a developer. I've registered my application. I've created an AWS account. I've created an IAM user. I've created an IAM policy. I've created an IAM role. The user has 'assume role'. I've self-authorised the app. I've got the refresh token. I've have the C# SDK which after some messing about, I got it to work. I've configured my AWS credentials. I've NOT configured my AWS credentials provider because this class doesn't seem to exist in the C# SDK. I've configured my LWA credentials. I've not created an instance of the Sellers API as it's not the C# SDK either!

How do us C# people move forward with this? :-D

Thanks, Antony...

lzy6666666 commented 3 years ago

https://github.com/amzn/selling-partner-api-docs image https://github.com/amzn/selling-partner-api-models/tree/main/clients/sellingpartner-api-aa-csharp

neil-119 commented 3 years ago

Unfortunately, their C# client is nowhere near as good as their Java one. It's missing a lot of things. There's a code sample below which may help you.

https://github.com/amzn/selling-partner-api-models/issues/31

BeeBee234 commented 3 years ago

Howdy,

The C# sample code in https://github.com/amzn/selling-partner-api-models/issues/31 works IF you've got all of your credentials in place. At this point I would give up on the C# SDK if I were you.

You can test all of your credentials in that sample code using the following Sandbox endpoint call and parameters (THE FOLLOWING WORKS for me):

(1) var resource = $"/vendor/orders/v1/purchaseOrders"; IRestRequest restRequest = new RestRequest(resource, Method.GET); restRequest.AddParameter("createdAfter", "2019-08-20", ParameterType.QueryString); restRequest.AddParameter("createdBefore", "2019-09-21", ParameterType.QueryString);

When I tried that with the following parameters I got "Bad Request: invalid parameters":

        restRequest.AddParameter("createdAfter", DateTime.UtcNow.AddDays(-5).ToString("yyyy-MM-dd"), ParameterType.QueryString);
        restRequest.AddParameter("createdBefore", DateTime.UtcNow.ToString("yyyy-MM-dd"), ParameterType.QueryString);

When I tried the code directly above with var resource = $"/vendor/directFulfillment/orders/v1/purchaseOrders" I got "Forbidden/Unauthorized".

When I tried the following parameters (as suggested in the sandbox sample api call) I got "Internal Server Error, Please Try Again."

      restRequest.AddParameter("CreatedAfter", "TEST_CASE_200", ParameterType.QueryString);
      restRequest.AddParameter("MarketplaceIds", "[\"ATVPDKIKX0DER\"]", ParameterType.QueryString);

So "Unauthorized/Access denied/Forbidden" does not give you any useful information. With (1) above you can at least test to make sure your credentials are all in order and then try calling the actual endpoint you are interested in.

Good luck and have a super awesome day,

Brian

abuzuhri commented 2 years ago

Try to Use my library handle most of requirement https://github.com/abuzuhri/Amazon-SP-API-CSharp

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.

lzy6666666 commented 2 years ago

收到,谢谢!!!(自动回复)

rugved1991 commented 1 year ago

Hi,

We recently launched a blog regarding automating SP API calls using C# SDK. Please refer to this blog for more information on how to setup C# SDK. Feel free to reopen the issue if issue persists.

Best, Rugved Solutions Architect, SP API

lzy6666666 commented 1 year ago

收到,谢谢!!!(自动回复)