TS Commerce Developers

Inventory API

Current version: v1.1

Get global inventory status

GET
/inventory/list.json
Get global inventory status Request

$storeden = new Storeden\Storeden($config);
$result = $storeden->get('/inventory/list.json');
					
Get global inventory status Response

[
    {
        "sku": "a58",
        "uid": 49532,
        "quantity": 0,
        "unlimited": false,
        "has_child": true,
        "childs": [
            {
                "sku": "0000125452",
                "quantity": 1005,
                "superkey": "40"
            },
            {
                "sku": "0000125453",
                "quantity": 1005,
                "superkey": "42"
            }
        ]
    },
    ...
    {
        "sku": "79",
        "uid": 49649,
        "quantity": null,
        "unlimited": false,
        "has_child": false
    }
]
					

Update Product quantity

PUT
/inventory/inventory.json
sku required (string) Unique id of your post
quantity required (int)
is_child (int) Accept 1 or 0 as value. If the specified SKU is a product-variant SKu, you must set this field to 1.
unlimited (int) 0|1 Only applicable on main product, not on variants. Accept 1 or 0 as value. 1 => Unlimited sell, 0 => selle stock quantities.
Update Product quantity Request

$storeden = new Storeden\Storeden($config);

$payload = array();
$payload['sku'] = '0000125452';
$payload['quantity'] = 1005;
$payload['is_child'] = 1;

$result = $storeden->put('/inventory/inventory.json', $payload);
					
Update Product quantity Response

{
    "is_child": true,
    "inventory_updated": 1,
    "err": null
}
					

Patch Product quantity

Send product quantity update to add to product stock quantity

PUT
/inventory/patchInventory.json
sku required (string) Unique id of your post
quantity required (int)
is_child (int) Accept 1 or 0 as value. If the specified SKU is a product-variant SKu, you must set this field to 1.
Patch Product quantity Request

$storeden = new Storeden\Storeden($config);

$payload = array();
$payload['sku'] = '0000125452';
$payload['quantity'] = 5;
$payload['is_child'] = 1;

$result = $storeden->put('/inventory/patchInventory.json', $payload);
					
Patch Product quantity Response

{
    "is_child": true,
    "inventory_updated": 1,
    "err": null
}
					

Batch Inventory Update

Send bulk update to inventory. Max 250 SKU at time

PUT
/inventory/batchInventory.json
stage[$sku][quantity] required (int) $sku must be replaced by your item SKU
stage[$sku][is_child] required (0|1) Accept 1 or 0 as value. If the specified SKU is a product-variant SKu, you must set this field to 1.
Batch Inventory Update Request

$storeden = new Storeden\Storeden($config);

$batch = array();
$batch['stage']['Uii']['quantity'] = 19;
$batch['stage']['Uii']['is_child'] = 0;

$batch['stage']['Jok']['quantity'] = 29;
$batch['stage']['Jok']['is_child'] = 0;

$batch['stage']['Kj']['quantity'] = 10000;
$batch['stage']['Kj']['is_child'] = 0;

$_response = $sdk->put('/inventory/batchInventory.json', $batch);
					
Batch Inventory Update Response

{
    "batchId": "e2d09ce2-f80c-4270-9bfb-98ed94972ec0",
    "responses": {
        "Uii": {
            "is_child": false,
            "inventory_updated": 0,
            "err": null
        },
        "Jok": {
            "is_child": true,
            "inventory_updated": 1,
            "err": null
        },
        "Kj": {
            "is_child": true,
            "inventory_updated": 1,
            "err": null
        }
    }
}