import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.inventoryItem.listLevels("iitem_123")
.then(({ inventory_levels, count, limit, offset }) => {
console.log(inventory_levels)
}){
"limit": 123,
"offset": 123,
"count": 123,
"inventory_levels": [
{
"id": "<string>",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"available_quantity": 123,
"incoming_quantity": 123,
"metadata": {}
}
]
}Retrieve a list of inventory levels associated with an inventory item. The inventory levels can be filtered by fields like location_id. The inventory levels can also be paginated.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.inventoryItem.listLevels("iitem_123")
.then(({ inventory_levels, count, limit, offset }) => {
console.log(inventory_levels)
}){
"limit": 123,
"offset": 123,
"count": 123,
"inventory_levels": [
{
"id": "<string>",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"available_quantity": 123,
"incoming_quantity": 123,
"metadata": {}
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The inventory item's ID.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Whether to include deleted records in the result.
Filter by the inventory item's location ID.
OK
The paginated list of inventory levels. The paginated list of inventory levels.
The maximum number of items returned.
The number of items skipped before retrieving the returned items.
The total number of items.
The inventory item's inventory levels.
Show child attributes
The inventory level's ID.
The ID of the associated inventory item.
The ID of the associated location.
The inventory level's stocked quantity.
The inventory level's reserved quantity.
The inventory level's available quantity.
The inventory level's incoming quantity.
The inventory level's metadata, can hold custom key-value pairs.