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.batchInventoryItemsLocationLevels({
create: [{
inventory_item_id: "iitem_123",
location_id: "sloc_123",
stocked_quantity: 10
}],
delete: ["ilvl_123"]
})
.then(({ created, updated, deleted }) => {
console.log(created, updated, deleted)
}){
"created": [
{
"id": "<string>",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"available_quantity": 123,
"incoming_quantity": 123,
"metadata": {}
}
],
"updated": [
{
"id": "<string>",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"available_quantity": 123,
"incoming_quantity": 123,
"metadata": {}
}
],
"deleted": [
"<string>"
]
}Manage inventory levels to create, update, or delete them.
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.batchInventoryItemsLocationLevels({
create: [{
inventory_item_id: "iitem_123",
location_id: "sloc_123",
stocked_quantity: 10
}],
delete: ["ilvl_123"]
})
.then(({ created, updated, deleted }) => {
console.log(created, updated, deleted)
}){
"created": [
{
"id": "<string>",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"available_quantity": 123,
"incoming_quantity": 123,
"metadata": {}
}
],
"updated": [
{
"id": "<string>",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"available_quantity": 123,
"incoming_quantity": 123,
"metadata": {}
}
],
"deleted": [
"<string>"
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The inventory levels to manage.
The inventory levels to create.
The inventory levels to update.
Show child attributes
The ID of the associated stock location.
The ID of the associated inventory item.
The stocked quantity.
The incoming quantity to be added to stock.
The update's ID.
The IDs of the inventory levels to delete.
The ID of the inventory level to delete.
Whether to delete specified inventory levels even if they have a non-zero stocked quantity.
OK
The result of managing inventory levels.
The created 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.
The updated 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.
The IDs of deleted inventory levels.
The ID of a deleted inventory level.