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
618 stars 741 forks source link

How to get quantity of inventory form ASIN code #4117

Closed georgelxl6 closed 3 months ago

georgelxl6 commented 3 months ago

I tired to get the remain quantity of inventory from ASIN code, but I can't. This is my python code

requests.get(amzn_product_entrypoint+product['asin']+"?marketplaceIds="+amzn_marketplace_id+"&includedData=attributes,dimensions,identifiers,images,productTypes,salesRanks,summaries,relationships", headers=amzn_get_product_data_header)

amzn_product_data_json = json.loads(amzn_product_data_byte)

quantity = amzn_product_data_json['attributes']['number_of_items'][0]['value']

I tried like above, the it is not the correct value. What is wrong.

leonardonakagawa commented 3 months ago

Hi @georgelxl6,

Could you provide more details in which API are you calling? In order to retrieve inventory information from a seller you need to do it by SKU level and not ASIN.

You can get inventory quantity in both ways below:

1) Call the getListingsItem API, the parameter includedData = attributes will give you this information under the fulfillment_availability attribute. This method uses SKU to fetch the information.

2) Get the report GET_MERCHANT_LISTINGS_ALL_DATA and the column quantity will provide the value in the ASIN level.

Thanks, Leonardo Nakagawa Solutions Architect, Selling Partner API Developer Support

georgelxl6 commented 3 months ago

Thank you for your response. I am using catalog API https://sellingpartnerapi-fe.amazon.com/catalog/2022-04-01/items/ I know only ASIN code

leonardonakagawa commented 3 months ago

Hi @georgelxl6,

In that case, I recommend you use the GET_MERCHANT_LISTINGS_ALL_DATA where you can have the inventory information and also the seller-sku attribute where after if needed you can call the getListingsItem API.

Thanks, Leonardo Nakagawa Solutions Architect, Selling Partner API Developer Support

github-actions[bot] commented 3 months ago

closed for inactivity