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.reservation.update("res_123", {
quantity: 20,
})
.then(({ reservation }) => {
console.log(reservation)
}){
"reservation": {
"id": "<string>",
"line_item_id": "<string>",
"location_id": "<string>",
"quantity": 123,
"external_id": "<string>",
"description": "<string>",
"inventory_item_id": "<string>",
"inventory_item": {
"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": {}
}
]
},
"metadata": {},
"created_by": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Update a reservation’s details.
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.reservation.update("res_123", {
quantity: 20,
})
.then(({ reservation }) => {
console.log(reservation)
}){
"reservation": {
"id": "<string>",
"line_item_id": "<string>",
"location_id": "<string>",
"quantity": 123,
"external_id": "<string>",
"description": "<string>",
"inventory_item_id": "<string>",
"inventory_item": {
"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": {}
}
]
},
"metadata": {},
"created_by": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The reservation'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.
OK
The reservation's details.
The reservation's details.
Show child attributes
The reservation's ID.
The ID of the line item this reservation is for.
The ID of the location the quantity is reserved from.
The reservation's quantity.
An ID in an external system
The reservation's description.
The ID of the inventory item this reservation is associated with.
The inventory item's details.
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.
The reservation's metadata, can hold custom key-value pairs.
The ID of the user that created this reservation.
The date this reservation was deleted.
The date this reservation was created.
The date this reservation was updated.