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.list()
.then(({ inventory_items, count, limit, offset }) => {
console.log(inventory_items)
}){
"limit": 123,
"offset": 123,
"count": 123,
"inventory_items": [
{
"id": "<string>",
"requires_shipping": true,
"sku": "<string>",
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"weight": 123,
"length": 123,
"height": 123,
"width": 123,
"title": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"metadata": {},
"location_levels": [
{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"incoming_quantity": 123,
"metadata": {},
"available_quantity": 123,
"inventory_item": {}
}
]
}
]
}Retrieve a list of inventory items. The inventory items can be filtered by fields such as id. The inventory items can also be sorted or 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.list()
.then(({ inventory_items, count, limit, offset }) => {
console.log(inventory_items)
}){
"limit": 123,
"offset": 123,
"count": 123,
"inventory_items": [
{
"id": "<string>",
"requires_shipping": true,
"sku": "<string>",
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"weight": 123,
"length": 123,
"height": 123,
"width": 123,
"title": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"metadata": {},
"location_levels": [
{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"incoming_quantity": 123,
"metadata": {},
"available_quantity": 123,
"inventory_item": {}
}
]
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
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 -.
The inventory item's q.
The inventory item's ID.
The inventory item's sku.
The inventory item's origin country.
The inventory item's mid code.
The inventory item's hs code.
The inventory item's material.
The inventory item's requires shipping.
Filter the inventory item's weight.
Show child attributes
Filter by an exact match.
Filter by values not matching this parameter.
Filter by values in this array's items.
Filter by values not in this array's items.
Apply a like filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Filter arrays that contain some of the values of this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Filter the inventory item's length.
Show child attributes
Filter by an exact match.
Filter by values not matching this parameter.
Filter by values in this array's items.
Filter by values not in this array's items.
Apply a like filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Filter arrays that contain some of the values of this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Filter by the inventory item's height.
Show child attributes
Filter by an exact match.
Filter by values not matching this parameter.
Filter by values in this array's items.
Filter by values not in this array's items.
Apply a like filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Filter arrays that contain some of the values of this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Filter by the inventory item's width.
Show child attributes
Filter by an exact match.
Filter by values not matching this parameter.
Filter by values in this array's items.
Filter by values not in this array's items.
Apply a like filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Filter arrays that contain some of the values of this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Whether to include deleted records in the result.
OK
The paginated list of inventory items. The paginated list of inventory items.
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 items.
Show child attributes
The inventory item's ID.
Whether the inventory item requires shipping.
The inventory item's sku.
The inventory item's origin country.
The inventory item's HS code.
The inventory item's MID code.
The inventory item's material.
The inventory item's weight.
The inventory item's length.
The inventory item's height.
The inventory item's width.
The inventory item's title.
The inventory item's description.
The thumbnail URL of the inventory item.
Custom key-value pairs, used to store additional information about the inventory item.
The inventory item's location levels.
Show child attributes
The location level's ID.
The location level's created at.
The location level's updated at.
The location level's deleted at.
The location level's inventory item id.
The location level's location id.
The location level's stocked quantity.
The location level's reserved quantity.
The location level's incoming quantity.
The location level's metadata.
The location level's available quantity.