简体   繁体   中英

Magento 2 stock information from Rest API

I am trying to get stock information for all products from Magento 2's rest api.

I have yet to find a way, that does not require me to either modify the magento 2 code (which isn't an option for me) as explained on Magento 2: Get Product Stock Quantity and Other Stock Information

The alternative I have found, is to call /V1/stockItems/ from the API, but that will only allow me to get one item pr call.

Is there really no way in 2020 to get a inventory overview from Magento 2 :)

This might help...

I found /rest/V1/stockItems/lowStock?scopeId=0&qty=1000&pageSize=10000

seemed to return what I wanted, and seems to return as many products as I need (5000+) in one call.

It returns is_in_stock and qty as well as the product ID and all the other stock_item fields, tho you will need a stored DB of all the magneto product IDs to cross reference it with, as you don.t get SKU or Name back.

That said, I don't know WHY it works, I presume its returning all items with < 1000 stock units?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM