Edit Item
Updates the details of an existing item in the inventory. This endpoint is used to modify any of the item’s attributes such as item name, price, quantity, or description.
Last updated
<?php
$item_code = 'YOUR_ITEM_CODE'; // Replace 'YOUR_ITEM_CODE' with your actual item code
$data = [
'item_name' => "Recliner Sofa",
'category_id' => 2,
'unit' => "kg",
'description' => "Sofa with one or more seats that recline like a recliner chair.",
'unit_cost' => 300.00,
'item_price' => 450.00,
'previous_price' => 350.00,
'quantity' => "50",
'minimum_qty_alert' => "5",
'online' => 1,
'status' => "in-stock",
'barcode' => "YOUR ITEM BARCODE", // Replace 'YOUR ITEM BARCODE' with your actual item barcode
'sku' => "TABLE001",
'warehouse_id' => 2,
'item_location' => "A1",
'item_slug' => "table"
];
$url = 'https://api.xtrakit.com/api/v1/inventory/items/' . $item_code;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>const axios = require('axios');
const item_code = 'YOUR_ITEM_CODE'; // Replace 'YOUR_ITEM_CODE' with your actual item code
const data = {
'item_name': "Recliner Sofa",
'category_id': 2,
'unit': "kg",
'description': "Sofa with one or more seats that recline like a recliner chair.",
'unit_cost': 300.00,
'item_price': 450.00,
'previous_price': 350.00,
'quantity': "50",
'minimum_qty_alert': "5",
'online': 1,
'status': "in-stock",
'barcode': "YOUR ITEM BARCODE", // Replace 'YOUR ITEM BARCODE' with your actual item barcode
'sku': "TABLE001",
'warehouse_id': 2,
'item_location': "A1",
'item_slug': "table"
};
const config = {
method: 'put',
url: `https://api.xtrakit.com/api/v1/inventory/items/{item_code}`,
headers: {
'Authorization': 'Bearer API_KEY' // Replace 'API_KEY' with your actual API key
},
data: data
};
axios(config).then(function(response) {
console.log(JSON.stringify(response.data));
}).catch(function(error) {
console.error(error);
});
import requests
item_code = 'YOUR_ITEM_CODE' # Replace 'YOUR_ITEM_CODE' with your actual item code
data = {
'item_name': "Recliner Sofa",
'category_id': 2,
'unit': "kg",
'description': "Sofa with one or more seats that recline like a recliner chair.",
'unit_cost': 300.00,
'item_price': 450.00,
'previous_price': 350.00,
'quantity': "50",
'minimum_qty_alert': "5",
'online': 1,
'status': "in-stock",
'barcode': "YOUR ITEM BARCODE", # Replace 'YOUR ITEM BARCODE' with your actual item barcode
'sku': "TABLE001",
'warehouse_id': 2,
'item_location': "A1",
'item_slug': "table"
}
url = f'https://api.xtrakit.com/api/v1/inventory/items/{item_code}'
headers = {
"Authorization": "Bearer API_KEY" # Replace 'API_KEY' with your actual API key
}
try:
response = requests.put(url, headers=headers, json=data)
print(response.json())
except requests.exceptions.RequestException as e:
print(e){
"status": 200,
"message": "Item updated successfully",
"data": {
"item": {
"id": 2,
"item_code": "Jce84a60",
"item_name": "Recliner Sofa",
"category_id": 2,
"unit": "kg",
"description": "Sofa with one or more seats that recline like a recliner chair.",
"unit_cost": 300.00,
"item_price": 450.00,
"previous_price": 250.00,
"quantity": "50",
"minimum_qty_alert": "5",
"online": 1,
"status": "in-stock",
"barcode": null,
"sku": "TABLE001",
"warehouse_id": 2,
"item_location": "A1",
"item_slug": "table",
"created_at": "2024-08-04 08:23:45",
"updated_at": "2024-08-04 02:00:43"
},
"item-category": [
{
"id": 2,
"category_name": "Furnitures",
"created_at": "2024-08-04 08:23:45",
"updated_at": "2024-08-04 02:00:43",
},
...
],
}
}{
"status": 401,
"error": "Authentication invalid"
},
{
"status": 401,
"error": "Unauthorized: Invalid API Key"
}