Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce REST endpoints to fetch saleable quantity / stock data for a list of skus #3415

Open
SamJUK opened this issue Sep 26, 2024 · 2 comments

Comments

@SamJUK
Copy link

SamJUK commented Sep 26, 2024

Description (*)

According to the documentation at https://developer.adobe.com/commerce/webapi/rest/inventory/check-salable-quantity/
We currently have REST endpoints for checking both, if a single sku or multiples skus are saleable. Via the following routes

GET /V1/inventory/is-product-salable/:sku/:stockId
GET /V1/inventory/are-products-salable/:skus[]/:stockId

Although when it comes to fetching the actual saleable quantity, there is only a endpoint to check a singular product at a time.

GET /V1/inventory/get-product-salable-quantity/:sku/:stockId

In the context of external ERP systems / marketplaces, it quite common to perform regular stock retrieval from Magento to ensure accurate stock counts. Currently this means making a single request for each product, which for large catalogs can amount to a lot of requests & wasted bandwidth compared to being able to batch multiple products into a single request.

Expected behavior (*)

Offer a endpoint to fetch saleable qty for multiple products similar to are-products-saleable.

GET GET /V1/inventory/get-products-salable-quantities/:sku[]/:stockId

Benefits

  • Reduction in needed REST calls for fetching stock data when working with large sets of catalog products.
  • Reduction in system & database load (compared to individual calls per product)
  • Reduced bandwidth usage & carbon emissions (compared to individual calls per product)

Additional information

Functionality seems to be a popular request in the magento2 repository, with people requiring stockItems on the product list endpoint, see the references below.

See the following comment on one of the PRs from Sidolov, around removing the stock data from the catalog REST endpoints. Although currently there seems to be no alternative to bulk load stock/qty data for a set of skus. magento/magento2#28435 (comment)

Copy link

m2-assistant bot commented Sep 26, 2024

Hi @SamJUK. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

@lamasfoker
Copy link

@SamJUK I think you can use this endpoint with the proper search criteria and get the same result of your proposal. Unfortunately there is a bug in that API, see #3416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants