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.

Endpoint

PUT https://app.xtrakit.com/api/v1/inventory/items/{item_code}

Headers

Authorization: Bearer API_KEY

Path Parameters

Parameters
Type
Description

item_code

string

Required

The unique code for identifying the item in the inventory system. Should be passed through the URL.(Jce84a50)

Body Parameters

Parameters
Type
Description

item_name

string

Required

The name or title of the item.

category_id

int

Required

The ID representing the category this item belongs to.

unit

string

Required

The unit of measure for the item.

(pcs, kg, liters,...)

description

string

Optional

A detailed description of the item, providing more information about its features.

unit_cost

decimal(10,2)

Required

The cost price of a single unit of the item in this format: 10.00

item_price

decimal(10,2)

Required

The selling price of the item in this format: 10.00

previous_price

decimal(10,2)

Optional

The previous selling price of the item in this format: 10.00

quantity

string

Required

The available stock or quantity of the item.

minimum_qty_alert

string

Optional

A threshold quantity that triggers an alert when stock falls below this level.

online

int

Required

Indicator whether the item is available online.

Accepts 1 (true) or 0 (false)

status

string

Required

The availability status of the item.

(available, out of stock).

barcode

string

Optional

The barcode assigned to the item.

sku

string

Optional

The Stock Keeping Unit (SKU) for tracking inventory.

warehouse_id

int

Optional

The ID of the warehouse where the item is stored.

item_location

string

Optional

The physical location of the item within the warehouse.

item_slug

string

Optional

A URL-friendly version of the item name used in links and routes.

Sample Requests

<?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://app.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;

?>

Sample Response

{
    "status": 200,
    "message": "Item updated successfully",
    "data": {
        "item": {
            "id": 2,
            "user_id": "f93c5a51-ffa4-4aef-a45b-4cdec1c8cc10",
            "business_code": "15848484",
            "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,
                "user_id": "f93c5a51-ffa4-4aef-a45b-4cdec1c8cc10",
                "business_code": "15848484",
                "category_name": "Furnitures",
                "created_at": "2024-08-04 08:23:45",
                "updated_at": "2024-08-04 02:00:43",
            },
            ...
        ],
    }
}

Last updated