Replace inventory data - Fabric
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Replace inventory data
cURL
curl --request PUT \
--url https://api.fabric.inc/v3/carts/{cartId}/inventory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '
{
"lineItems": [
{
"sku": "SKU3",
"channels": {
"networkCode": "ShipToHome"
},
"counters": {
"backOrder": 15,
"preOrder": 100
}
}
]
}
'```
### Python
```python
import requests
url = "https://api.fabric.inc/v3/carts/{cartId}/inventory"
payload = { "lineItems": [
{
"sku": "SKU3",
"channels": { "networkCode": "ShipToHome" },
"counters": {
"backOrder": 15,
"preOrder": 100
}
}
] }
headers = {
"x-fabric-tenant-id": "<x-fabric-tenant-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch API)
const options = {
method: 'PUT',
headers: {
'x-fabric-tenant-id': '<x-fabric-tenant-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
lineItems: [
{
sku: 'SKU3',
channels: {networkCode: 'ShipToHome'},
counters: {backOrder: 15, preOrder: 100}
}
]
})
};
fetch('https://api.fabric.inc/v3/carts/{cartId}/inventory', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fabric.inc/v3/carts/{cartId}/inventory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'lineItems' => [
[
'sku' => 'SKU3',
'channels' => [
'networkCode' => 'ShipToHome'
],
'counters' => [
'backOrder' => 15,
'preOrder' => 100
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-fabric-tenant-id: <x-fabric-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Response Structure
{
"id": "c86f777b-1885-4ddf-961d-542ba80a69b8",
"attributes": {
"name": "wishlist"
},
"configuration": {
"order": {
"validate": {}
},
"product": {
"cacheExpiry": 7776000,
"behaviors": {
"add": "REJECT",
"update": "WARN",
"get": "WARN",
"cacheExpiry": "WARN"
},
"maxQuantity": {
"limit": 100,
"behaviors": {
"add": "REJECT",
"update": "WARN",
"get": "WARN"
}
}
},
"inventory": {
"cacheExpiry": 7776000,
"behaviors": {
"add": "REJECT",
"update": "WARN",
"get": "WARN",
"cacheExpiry": "WARN"
},
"check": "SKU"
}
}
}
Error Messages
{
"type": "BAD_REQUEST",
"message": "x-fabric-tenant-id is required"
}
{
"type": "CART_NOT_FOUND",
"message": "Cart not found"
}