0

I ran the Magento Rest API to get the stock id for a particular product but it's showing me the wrong stock id. We have three websites and each website has a separate stock, but when we call Magento API for these three websites, the stock is shown the same for every product which is wrong. Can anyone please help me here as this is urgent for maintaining correct stocks for our website?

Please find below the result for the Magento Rest API

METHOD - GET

URL - http://127.0.0.1:8080/rest/kind_uk_en/V1/products/KIN30137

{

"stock_item": {
  "item_id": 1822,
  "product_id": 193,
  "stock_id": 1,
  "qty": 15,
  "is_in_stock": true,
  "is_qty_decimal": false,
  "show_default_notification_message": false,
  "use_config_min_qty": true,
  "min_qty": 1,
  "use_config_min_sale_qty": 1,
  "min_sale_qty": 1,
  "use_config_max_sale_qty": true,
  "max_sale_qty": 10000,
  "use_config_backorders": true,
  "backorders": 0,
  "use_config_notify_stock_qty": true,
  "notify_stock_qty": 1,
  "use_config_qty_increments": true,
  "qty_increments": 0,
  "use_config_enable_qty_inc": true,
  "enable_qty_increments": false,
  "use_config_manage_stock": false,
  "manage_stock": true,
  "low_stock_date": null,
  "is_decimal_divided": false,
  "stock_status_changed_auto": 0
}
}
1
  • Hey Ashish, later you got any solution for this? I am using Magento 2.4.3-p1 with MSI I am facing this same issue and want stock based on what I assigned to that scope. Please share if you got any solution, many thanks
    – Deepak
    Commented Dec 5, 2022 at 13:29

1 Answer 1

0

Try using this endpoint instead /rest/default/V1/stockItems/{productSku} (just replace 'default' scope as you need) (Please refer to https://magento.redoc.ly/2.4.2-admin/tag/stockItemsproductSku#operation/catalogInventoryStockRegistryV1GetStockItemBySkuGet for further details).

1
  • Hi , thanks for your help . We tried running the api with different scopes but it's still showing stock_id=1 . Commented Jun 22, 2021 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.