0

I am trying to make an API call to get order metrics from the amazon seller central page from Postman App. I have followed all the steps in the documentation. I self authorized my app using the refresh token found on the Developer Central page. I am able to generate the access token using the refresh token. When making a request to the api to get order metrics, the query parameters are : marketplaceIds : A21TJRUUN4KGV (India) interval : 2021-01-01T00:00:00-07:00--2021-09-04T00:00:00-07:00 granularity : Day

The AWS signature for this request has my access key and secret key derived from when I created the IAM User. The region is eu-west-1 and service name is execute-api.

In the headers I have passed x-amz-access-token: Atza|IwExxxxxxx user agent:PostmanRuntime/7.26.8 Host: sellingpartnerapi-eu.amazon.com x-amz-date : calculated when request is sent

After sending the request I get this response:

{
    "errors": [
        {
            "message": "Access to requested resource is denied.",
            "code": "Unauthorized",
            "details": ""
        }
    ]
}

403 Forbidden: Request is legal but server is refusing to respond. Authenticating will make no difference.

I have logged case with Seller Central support but it has been over a month and they haven't replied. Please tell me what should I add or remove or check to make this request work.

Manaal Soni
  • 73
  • 12
  • I have same issue but i fixed it through aws signature....but getting empty payload with 200 response code. Do you have any idea about this issue ? https://stackoverflow.com/questions/66869205/amazon-sp-api-getorder-api-empty-response-with-200-response-code – Shailesh Dwivedi Mar 30 '21 at 10:31
  • why you are using Marketplaceids and granularity ? Although in swagger 2.0 doc it's only required orderId for request payload. – Shailesh Dwivedi Mar 30 '21 at 10:34
  • I don't exactly know the reason for empty payload. I encountered the same once, please check the parameters you are passing if any. Are you applying any date filter? I am using marketplaceids and granularity because under the category of Orders, there are different kinds of requests. The one where you pass only order id is getOrder whereas the one mentioned above is getOrderMetrics. There are more such as getBuyerInfo, getOrderItems, etc. You will find all these present in the swagger doc. – Manaal Soni Mar 30 '21 at 18:37
  • getOrderMetrics - https://github.com/amzn/selling-partner-api-docs/blob/main/references/sales-api/sales.md on this link you can see the details. I checked your question for empty payload. I am sorry I am not aware why it is giving empty payload. – Manaal Soni Mar 30 '21 at 18:39
  • [Hi, I struggled a lot to solve this issue for Google Sheet with same authorization error and finally found the solution by changes in IAM Policy. As per Amazon Developer documentation, they guided for create new policy but I suggest you to skip that step and add inline policy directly on IAM User. I know that this is not good practice but this step solved my 'Authorization' issue. After creating an IAM User. Generate app in developer apps sections using IAM USER ARN and generate refresh token also from the created new app in Develops Apps section using 'Authorize' button.](https://stackoverfl – mukeshesic Jun 28 '21 at 05:01
  • Can I get order metrics for multiple marketplaces? – Muhammad Tarique Jul 28 '21 at 06:59
  • Yes, you can, pass marketplace ids as a string array – Manaal Soni Jul 29 '21 at 02:49

1 Answers1

0

https://docs.amazonaws.cn/en_us/IAM/latest/UserGuide/id_credentials_temp_request.html

Following this gave me temporary access token, access secret key and session token. Using that in the AWS signature for getting orders gave the desired output.

Manaal Soni
  • 73
  • 12