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

/fba/inventory/v1/summaries #787

Closed ahlmackie closed 1 year ago

ahlmackie commented 3 years ago

is any one else having authorization issues with this endpoint (res status code 403)? I am using the sellingpartnerapi-eu.amazon.com host I'm passing authorization on all the other end points i have used so far, so just a bit strange

JacksonJeans commented 3 years ago

Do your requests to other APIs works from the SP-API ?

ahlmackie commented 3 years ago

yes, i've tried a dozen other endpoints and they are all passing authorization with 200 status codes

this is the url I aam having an issue with:

https://sellingpartnerapi-eu.amazon.com/fba/inventory/v1/summaries?granularityType=Marketplace&granularityId=A1F83G8C2ARO7P&marketplaceIds=A1F83G8C2ARO7P&startDateTime=2020-01-01

JacksonJeans commented 3 years ago

The HTTP status 403can have various reasons. You will always get a JSON back from Amazon with a more precise differentiation of the error.

In the SP-API we have several error cases that lead to the status 403and ultimately do not authorize you.

To identify the error more accurately, we need your canonical request. There it is usually already obvious why you get a 403 status back.

ahlmackie commented 3 years ago

Here you go:

GET /fba/inventory/v1/summaries granularityId=A1F83G8C2ARO7P&granularityType=Marketplace&marketplaceIds=A1F83G8C2ARO7P&startDateTime=2020-01-01 host:sellingpartnerapi-eu.amazon.com user-agent:amkapp/v1.0 (language=javascript) x-amz-access-token:Atza| x-amz-date:20201123T114051Z

host;user-agent;x-amz-access-token;x-amz-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

JacksonJeans commented 3 years ago

Unfortunately, I have often seen that the users of the API do not specify a content-type in their canonical request, although this must be included in the normal header. Already tried to specify it? I also get a 403 if I do not specify a content-type. Below I describe a problem where I also get a 403.

I also see that your canonical_uri does not end with /. Other users had similar problems with GET requests, but it didn't help them if the URI ends with / or they set the content-type. But maybe this helps you?

Try this one:

GET
/fba/inventory/v1/summaries/
granularityId=A1F83G8C2ARO7P&granularityType=Marketplace&marketplaceIds=A1F83G8C2ARO7P&startDateTime=2020-01-01
content-type: application/json
host:sellingpartnerapi-eu.amazon.com
user-agent:amkapp/v1.0 (language=javascript)
x-amz-access-token:Atza|
x-amz-date:20201123T114051Z

content-type;host;user-agent;x-amz-access-token;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ahlmackie commented 3 years ago

still no luck unfortunately (my other endpoints are working ok with the changes)

GET /fba/inventory/v1/summaries/ granularityId=A1F83G8C2ARO7P&granularityType=Marketplace&marketplaceIds=A1F83G8C2ARO7P&startDateTime=2020-01-01 content-type:application/json host:sellingpartnerapi-eu.amazon.com user-agent:amkapp/v1.0 (language=javascript) x-amz-access-token:Atza| x-amz-date:20201123T120830Z

content-type;host;user-agent;x-amz-access-token;x-amz-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

rogersv commented 3 years ago

The e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 indicates that you hashed an empty payload. You should not have a payload for this request

ahlmackie commented 3 years ago

thanks, the guides indicate that if there is no payload, use a blank string: https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html (point 6). If I exclude this i get a 403 response: 'x-amzn-errortype': 'InvalidSignatureException'?

JacksonJeans commented 3 years ago

@rogersv, I would say that here the payload must be empty. There is no parameter to add to the HTTPBody at this API endpoint. All parameters defined here in the documentation can be found in the query string: Type: Query . Here

Here are some useful links to see what a payload really is in the HTTP protocol: HTTP (wiki) RFC7231(IETF) payloads of http request methods (StackOverflow)

With absolute probability the payload will be empty after the documentation. Or can someone here share a different experience especially about the fba-inventory API?

@ahlmackie, I'm sorry, in your case I don't know what to do. If I am ready to work with the fba-inventory API, I will share my experience with you here.

EDIT What is the exact error message? Normally you will receive any message as JSON.

ahlmackie commented 3 years ago

thanks for you time @JacksonJeans I will let you know if I find the solution.

I've raised a case with amazon to see if they can shed some light. Unfortunately is the very generic 403 response (similar to that people were recieving when having trouble with the STS token flow in the docs). I've put the JSON response and response headers below:

response headers { date: 'Mon, 23 Nov 2020 12:08:42 GMT', 'content-type': 'application/json', connection: 'close', 'x-amzn-requestid': '772305d1-5005-4d50-b83a-0fc6620ab98e', 'x-amzn-errortype': 'AccessDeniedException', 'x-amz-apigw-id': 'WdbrpG27DoEFXNQ=' }

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

rogersv commented 3 years ago

Yes it should be empty. What I meant was "why is the "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" included in this request?". EDIT: I was incorrect. I should have read the question once more. :)

ahlmackie commented 3 years ago

@rogersv its just the final part of the string to be signed in the flow to calculate the signature... https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html (point 6). we were just checking the make up of the canonical request for errors

ununu commented 3 years ago

I'm having the same problem. Other endpoints mostly POST methods works fine, but this one returns "Unauthorized"

ahlmackie commented 3 years ago

I had a message from amazon: they have identified an issue their end for this API and have notified the engineers. Hopefully resolved soon

m4ciekm commented 3 years ago

Did they fix the problem? I'm also receiving the same message: "Access to requested resource is denied.", "code": "Unauthorized", whereas queries sent to "/orders/v0/orders" work without any issues.

ahlmackie commented 3 years ago

had a response from amazon saying it is not available yet, no guidance on when they plan to take it live I suspect Brexit has something to do with it

winterstefan commented 3 years ago

jfyi, same scenario here:

That reply came after a hell of a ride through various tickets and support requests. But I guess this information is final. At least the reply state that this official API documentation may be enhanced in order to clearly point out this fact. I did not hear information about if or when this use-case could be possible for EU.

ahlmackie commented 3 years ago

I am also having trouble with the notifications API in europe - getting a 403 status code, though I have been assure it is working..? @winterstefan are you able to access it? @seanevan are we able to get some guidance on what APIs are active in each region?

w2m commented 3 years ago

Did they fix the problem? I'm also receiving the same message: "Access to requested resource is denied.", "code": "Unauthorized", whereas queries sent to "/orders/v0/orders" work without any issues.

I have the same problem. Diy you fix?

paolofacchinetti commented 3 years ago

jfyi, same scenario here:

  • Trying to access SP-API (especially endpoint for fetching inventory)
  • Constantly getting HTTP 403 from the API
  • Support just now replied that this use-case is not possible at the moment the European marketplaces

That reply came after a hell of a ride through various tickets and support requests. But I guess this information is final. At least the reply state that this official API documentation may be enhanced in order to clearly point out this fact. I did not hear information about if or when this use-case could be possible for EU.

Can someone from the dev team confirm this? We've been developing on these APIs for a while and there's nothing at all in the documentation or any ufficial statement that confirms that the inventory APIs are not working for Europe.

If this is really the case, it's absolutely insane that there are NO WARNINGS about this, we're wasting our time building an application and we're stuck with 403 errors on getInventorySummaries calls.

edit: I've managed to find an ufficial statement in #207 , is there an ETA on when this could be solved? Are there any workarounds for now?

cohlar commented 3 years ago

I'm also interested to know when this endpoint will become available in Europe.

Jethro-Wilkinson commented 3 years ago

Me too. Having the same issue.

holger-core commented 3 years ago

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

ArmbrustR commented 3 years ago

Any news? any workarounds? Is it possible to get /reports/{date}/reports? -> I did try and got the same ErrorMessage

danielbebbernovacode commented 3 years ago

Are there any updates on this issue? We are working on an application that relies on that endpoint.

iamsr commented 3 years ago

The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in Amazon's fulfillment network. Today this API is available only in the North America region. In 2021 we plan to release this API in the Europe and Far East regions.

It's for only NA region so if you are trying other than that it won't work. That unauthorized error is related to "resources not found" not with your authentication.

ahmetsametoglu commented 3 years ago

This is a very basic feature. I couldn't get the detail of my fba_inventory quantity. What is your plan for this feature?

elrok1234 commented 3 years ago

Can someone from Amazon please confirm if the sandbox endpoints of the fba/inventory/v1/summaries is working for north america marketplaces? I am receiving the same error as what a few people have described:

Authorization:

{{AccessKeyId}}
{{SecretAccessKey}}
us-east-1
execute-api
{{SessionToken}}

Headers:

Authorization
X-Amz-Date
X-Amz-Security-Token
Postman-Token
Host
User-Agent
Accept
Accept-Encoding
Connection
x-amz-access-token

Thanks in advance

0xpetersatoshi commented 3 years ago

I'm also getting a 403 error on this endpoint and I am in North America (US).

iuzundal commented 3 years ago

Same problem for NA

shirushi-dev commented 3 years ago

Japanもです...😭

okuson commented 3 years ago

Not released in Japan. 日本ではリリースされていません。

Xfox1 commented 3 years ago

Problem still present in Europe:

{ 
  code: 'Unauthorized',
  details: '',
  type: 'error'
}
AmandeepSingh179 commented 3 years ago

I am getting the same error for UK marketplace. Is there anyone who get this endpoint working?

jkleupen commented 3 years ago

looks like they added the regional disclaimer back: https://github.com/amzn/selling-partner-api-docs/commit/1db11640e9414e0604c5513c16a516dd891396a7

svg-crstl commented 2 years ago

@elrok1234 - Did you manage to get this endpoint working for the North America region?

I'm getting the 403 error even in the North America region (on Sandbox).

The same token, signing approach etc - works perfectly for the getOrders endpoint

kdursun commented 2 years ago

Problem still present in Europe:

{ code: 'Unauthorized', details: '', type: 'error' } opened new case, waiting answer

fedecarossino commented 2 years ago

@kdursun have you received an answer from amazon support??

Gantonmaz commented 2 years ago

Has Amazon given a date as to when this might be available in the EU?

nassuf commented 2 years ago

Hi there, I have the same problem (eu marketplace). Do you guys have found another way to get seller's products informations ? Thanks !

stokebob commented 2 years ago

I've contacted Amazon developer support on this, and they have confirmed that the endpoint is still only available in North America. They could not give an ETA of when it will be available in Europe, only that I should monitor the changelog on their new documentation site.

https://developer-docs.amazon.com/sp-api/changelog

jlevers commented 2 years ago

That's strange, because I'm able to get some data from Europe using this endpoint -- it's just not fully consistent. If I specify the UK marketplace ID, I seem to get back cumulative data for all the European marketplaces. If I specify a non-UK marketplace ID, I seem to get back cumulative data for all the European marketplaces except the UK. If someone from Amazon could confirm what's actually going on here, that would be much appreciated.

cc @parvathm @ShivikaK

rugved1991 commented 2 years ago

Hi @jlevers @stokebob,

FBA Inventory API is available globally. Can you please test again and let us know if you are able to call the resource successfully? If the issue persists, please open a support case and let us know the case ID.

Best, Rugved Solutions Architect, SP API

jkleupen commented 2 years ago

Can confirm this is now working for EU.

Xfox1 commented 2 years ago

Still not working for me (EU, Italy):

{
    "message": "Access to requested resource is denied.",
    "code": "Unauthorized",
    "details": "",
    "type": "error"
}
bar2 commented 2 years ago

@Xfox1 and others that are getting error "403 - Unauthorized", did you add "Product Listing" role to your application and re-authorized subject account?

raimundosilvac commented 2 years ago

Can someone here write an example of how to do the request to this endpoint in NodeJs? I've been trying to access to this endpoint but I have the following error:

CustomError: 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'GET/fba/inventory/v1/summariesDetails=true&MarketplaceIds=A1RKKUPIHCS9HS&granularityId=A1RKKUPIHCS9HS&granularityType=Marketplacehost:sellingpartnerapi-eu.amazon.comuser-agent:amazon-sp-api/0.7.9 (Language=Node.js/v12.18.3; Platform=Linux/4.4.0-19041-Microsoft)x-amz-access-token:<hashed-value>
The String-to-Sign should have been'AWS4-HMAC-SHA25620220802T192536Z20220802/eu-west-1/execute-api/aws4_request<hashed-value>'

My code is the following using amazon-sp-api on node:

let sellingPartner = new SellingPartnerAPI({
                region:'eu',
                refresh_token: '<my_refresh_token>',
                credentials:{
                    SELLING_PARTNER_APP_CLIENT_ID: "<MY_SELLING_PARTNER_APP_CLIENT_ID>",
                    SELLING_PARTNER_APP_CLIENT_SECRET: "<MY_SELLING_PARTNER_APP_CLIENT_SECRET>",
                    AWS_ACCESS_KEY_ID: "<MY_AWS_ACCESS_KEY_ID>",
                    AWS_SECRET_ACCESS_KEY: "<MY_AWS_SECRET_ACCESS_KEY>",
                    AWS_SELLING_PARTNER_ROLE: "<MY_AWS_SELLING_PARTNER_ROLE>",
                }        
            })
            let loadRequest = await sellingPartner.callAPI({
                operation:'getInventorySummaries',
                endpoint: 'fbaInventory',
                query: {
                    Details: true,
                    MarketplaceIds: ['A1RKKUPIHCS9HS'],
                    granularityType: "Marketplace",
                    granularityId: 'A1RKKUPIHCS9HS'
                }
            });

Please, I don't know how to solve the error

nothinman commented 1 year ago

@raimundosilvac did you manage to resolve this in the end?

raimundosilvac commented 1 year ago

@nothinman yes i could!

nothinman commented 1 year ago

@nothinman yes i could!

Do you happen to remember what the issue was / how did you resolve it? Been struggling for two days...