Get Stock
Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Version | Date | Created / Updated | Notes |
---|---|---|---|
1.0 | 14.02.2025 | Bogomil Pavlov | First publish |
GET STOCK
Apart from the bulk stock get we want to introduce the get stock per product. We want to get all SKUs which are part of the Account to which the Magento2 Connector with active Get Inventory Flag is assigned and one by one to obtain the stock levels.
API Call: GET /V1/stockItems/{productSku}
API Docs: https://developer.adobe.com/commerce/webapi/rest/#routes
The location to which we want to assign the stock is obtained from the assigned connector Magento 2 Seller > Location
Example Call: GET https://www.johnsmedley.com/rest/all/V1/stockItems/seasonal_noahwhisml
Example Success Response 200:
{
"item_id": 177683,
"product_id": 136808,
"stock_id": 1,
"qty": 3,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": false,
"min_qty": 0,
"use_config_min_sale_qty": 0,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 6,
"use_config_backorders": false,
"backorders": 0,
"use_config_notify_stock_qty": false,
"notify_stock_qty": 0,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
}
Response Mapping:
Magento2 Field | Hemi Field | Comment |
---|---|---|
item_id |
N/A | |
product_id |
N/A | |
stock_id |
N/A | |
qty |
Products Location Quantities > Quantity | |
is_in_stock |
N/A | |
is_qty_decimal |
N/A | |
show_default_notification_message |
N/A | |
use_config_min_qty |
N/A | |
min_qty |
N/A | |
use_config_min_sale_qty |
N/A | |
min_sale_qty |
N/A | |
use_config_max_sale_qty |
N/A | |
max_sale_qty |
N/A | |
use_config_backorders |
N/A | |
backorders |
N/A |
Sample Error Response:
{
"message": "An error occurred validating the nonce"
}
We do not want to store the error in Hemi but to return it in the terminal for reference.