Lots
Create & Update Lot
# Create Lot
POST
`/v1/asset`
The only properties you need to create an asset is the item_id
and location_id
. However, we recommend adding some more properties to the lot.
item_id string (required) the identifier of the item. |
location_id string (required) the identifier of the location at which the lot will be created. |
address_id string the identifier of the address at which the lot will be stored. |
manufacturer_number string The manufacturer lot number. |
number string The lot number. |
expires_at string For perishable items or items that expire, this field represents the expiry date for the entire lot. |
status string The current status of the lot |
total_qty string The total quantity of items in the lot |
available_qty string The available quantity of items in the lot |
defective_qty string The defective quantity of items in the lot |
manifested_qty string The manifested quantity of items in the lot |
reserved_qty string The reserved quantity of items in the lot |
metadata Object The metadata of the lot |
js
const data = {
item_id: "item_5TngYZKdRFTSkcVCvNa885",
layout_id: "lay_vgM65sMYtakxwfXkTCC8FB",
address_id: "addr_8axWLqDo9kprqgNmFpCqxo",
number: "LOT_221X",
};
const res = await fetch(`https://api.packagex.io/v1/lot`, {
method: "POST",
headers: {
"PX-API-KEY": process.env.PX_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
}).then((res) => res.json());
const lot = res.data; //Refer to the lot model
# Update Lot
POST
`/v1/assets/:asset_id`Most of the asset properties can be updated, including
js
metadata
number
manufacturer_number
location_id
address_id
total_qty
available_qty
defective_qty
manifested_qty
reserved_qty
status
expires_at
js
const data = {
number: "LOT_221X",
manufacturer_number: "appl_1213"
expires_at: 1718973451936
};
const res = await fetch(`https://api.packagex.io/v1/lots/lot_12345678`, {
method: "POST",
headers: {
"PX-API-KEY": process.env.PX_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
}).then((res) => res.json());
const lot = res.data; //Refer to the lot model