Closed antonycartwright closed 1 year ago
@antonycartwright could you create a document somewhere if you have done all the steps successfully ? that could help others.
@antonycartwright could you create a document somewhere if you have done all the steps successfully ? that could help others.
I finally became successful last week but haven't had time to review the project yet. I could make a guide if I had time. If I get time over the next few weeks, I'll do this. Antony...
@antonycartwright could you create a document somewhere if you have done all the steps successfully ? that could help others.
I finally became successful last week but haven't had time to review the project yet. I could make a guide if I had time. If I get time over the next few weeks, I'll do this. Antony...
I am stuck with an "Access to requested resource is denied", "Unauthorized" error. I am still trying to resolve this. A guide will be great or any hint on how to get this resolved.
@antonycartwright could you create a document somewhere if you have done all the steps successfully ? that could help others.
I finally became successful last week but haven't had time to review the project yet. I could make a guide if I had time. If I get time over the next few weeks, I'll do this. Antony...
I am stuck with an "Access to requested resource is denied", "Unauthorized" error. I am still trying to resolve this. A guide will be great or any hint on how to get this resolved.
Hi, show your code. Antony...
I have tried "Website work flow" and "Self authorization" Code for Website Work Flow
var token = //get the access_token form database and refresh it if expired;
var client = new RestClient("https://sandbox.sellingpartnerapi-na.amazon.com");
IRestRequest restRequest = new RestRequest("/orders/v0/orders", Method.GET);
restRequest.AddQueryParameter("MarketplaceIds", "ATVPDKIKX0DER");
restRequest.AddHeader("x-amz-access-token", token.AccessToken);
var credentials = new SellerAPICredentials()
{
AWSKey = "My aws key",
AWSSecret = "My aws secret",
RoleARN = "My role arn",
ClientId = "My client id",
ClientSecret = "My client secret",
RefreshToken = "My refresh token"
};
restRequest = AmazonService.SignWithSTSKeysAndSecurityToken(restRequest, client.BaseUrl.Host, credentials.RoleARN, credentials.AWSKey, credentials.AWSSecret);
var response = client.Execute(restRequest);
For Self Authorization
var baseUrl = "https://sellingpartnerapi-na.amazon.com";
var client = new RestClient(baseUrl);
IRestRequest restRequest = new RestRequest("/orders/v0/orders", Method.GET);
restRequest.AddParameter("MarketplaceIds", "ATVPDKIKX0DER", ParameterType.QueryString);
restRequest.AddParameter("CreatedAfter", DateTime.UtcNow.AddDays(-5).ToString("yyyy-MM-dd"), ParameterType.QueryString);
var credentials = new SellerAPICredentials()
{
AWSKey = "My aws key",
AWSSecret = "My aws secret",
RoleARN = "My role arn",
ClientId = "My clientId",
ClientSecret = "My client secret",
RefreshToken = "My refresh token"
};
restRequest = AmazonService.SignWithAccessToken(restRequest, credentials.ClientId, credentials.ClientSecret, credentials.RefreshToken);
restRequest = AmazonService.SignWithSTSKeysAndSecurityToken(restRequest, client.BaseUrl.Host, credentials.RoleARN, credentials.AWSKey, credentials.AWSSecret);
var response = client.Execute(restRequest);
Functions used here are from this issue https://github.com/amzn/selling-partner-api-models/issues/31
I have tried "Website work flow" and "Self authorization" Code for Website Work Flow
var token = //get the access_token form database and refresh it if expired; var client = new RestClient("https://sandbox.sellingpartnerapi-na.amazon.com"); IRestRequest restRequest = new RestRequest("/orders/v0/orders", Method.GET); restRequest.AddQueryParameter("MarketplaceIds", "ATVPDKIKX0DER"); restRequest.AddHeader("x-amz-access-token", token.AccessToken); var credentials = new SellerAPICredentials() { AWSKey = "My aws key", AWSSecret = "My aws secret", RoleARN = "My role arn", ClientId = "My client id", ClientSecret = "My client secret", RefreshToken = "My refresh token" }; restRequest = AmazonService.SignWithSTSKeysAndSecurityToken(restRequest, client.BaseUrl.Host, credentials.RoleARN, credentials.AWSKey, credentials.AWSSecret); var response = client.Execute(restRequest);
For Self Authorization
var baseUrl = "https://sellingpartnerapi-na.amazon.com"; var client = new RestClient(baseUrl); IRestRequest restRequest = new RestRequest("/orders/v0/orders", Method.GET); restRequest.AddParameter("MarketplaceIds", "ATVPDKIKX0DER", ParameterType.QueryString); restRequest.AddParameter("CreatedAfter", DateTime.UtcNow.AddDays(-5).ToString("yyyy-MM-dd"), ParameterType.QueryString); var credentials = new SellerAPICredentials() { AWSKey = "My aws key", AWSSecret = "My aws secret", RoleARN = "My role arn", ClientId = "My clientId", ClientSecret = "My client secret", RefreshToken = "My refresh token" }; restRequest = AmazonService.SignWithAccessToken(restRequest, credentials.ClientId, credentials.ClientSecret, credentials.RefreshToken); restRequest = AmazonService.SignWithSTSKeysAndSecurityToken(restRequest, client.BaseUrl.Host, credentials.RoleARN, credentials.AWSKey, credentials.AWSSecret); var response = client.Execute(restRequest);
Functions used here are from this issue amzn/selling-partner-api-models#31
Your code looks fine to me. Take a look at your region and check that. Also, check permissions/policies/roles. For me, I gave the user and the role full permissions in the console area.
@antonycartwright can you please share your basic code for get orders using c# sdk.
@antonycartwright @bilal-yasin can you share your email address? maybe we can discuss some questions together
Hi @ClementeGao, @coder771,
Please let us know if you are still facing any issues. @antonycartwright @bilal-yasin thanks for the feedback regarding the C# SDK guide. We will surface this feedback to our tech writers. If you have created a guide already, please feel free to share with the developer community.
Best, Rugved Solutions Architect, SP API
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.
closed for inactivity
I've been using the C# SDK. The documentation lacks a lot of detail for us too. In my opinion, a new header for C# should be added here:
The documentation should probably give us at least basic steps for C# and then say "skip to Connecting to the Selling Partner API" when finished. In reality, there is a lot of missing detail for C#. In due time, this could be added to the documentation. I'd say there is around 3-4 pages of material to cover for C#.