Add Item
Allows you to add a new item to the inventory. This endpoint is used when introducing new products to your stock. You’ll need to provide essential details such as the item name, price and others.
Last updated
Allows you to add a new item to the inventory. This endpoint is used when introducing new products to your stock. You’ll need to provide essential details such as the item name, price and others.
Last updated
<?php
$data = [
'item_name' => "Dining Table",
'category_id' => 2,
'unit' => "kg",
'description' => "Wooden dining table with a polished finish.",
'unit_cost' => 200.00,
'item_price' => 300.00,
'previous_price' => 250.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/add';
$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 => 'POST',
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 data = {
'item_name': "Dining Table",
'category_id': 2,
'unit': "kg",
'description': "Wooden dining table with a polished finish.",
'unit_cost': 200.00,
'item_price': 300.00,
'previous_price': 250.00,
'quantity': "50",
'minimum_qty_alert': "5",
'online': 1,
'status': "in-stock",
'barcode': "YOUR ITEM BARCODE",
'sku': "TABLE001",
'warehouse_id': 2,
'item_location': "A1",
'item_slug': "table",
};
const config = {
method: 'post',
url: `https://api.xtrakit.com/api/v1/inventory/items/add`,
headers: {
'Authorization': 'Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.error(error);
});
import requests
data = {
'item_name': "Dining Table",
'category_id': 2,
'unit': "kg",
'description': "Wooden dining table with a polished finish.",
'unit_cost': 200.00,
'item_price': 300.00,
'previous_price': 250.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/add'
headers = {
"Authorization": "Bearer API_KEY" # Replace 'API_KEY' with your actual API key
"Content-Type": "application/json"
}
try:
response = requests.post(url, headers=headers, json=data)
print(response.json())
except requests.exceptions.RequestException as e:
print(e){
"status": 200,
"message": "Item added successfully",
"data": {
"item": {
"id": 2,
"item_code": " Jce84a60",
"item_name": "Dining Table",
"category_id": 2,
"unit": "kg",
"description": "Wooden dining table with a polished finish.",
"unit_cost": 200.00,
"item_price": 300.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"
}