Update cart - Fabric
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Update cart
cURL
curl --request PATCH \
--url https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '
{
"items": [\
{\
"itemId": 1234567,\
"quantity": 3,\
"lineItemId": 3,\
"price": {\
"currency": "USD",\
"base": 15.99,\
"sale": 10.99\
},\
"priceListId": 100000012,\
"discountedQuantity": 3,\
"isUnique": "123"\
}\
]
}'
Python
import requests
url = "https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items"
payload = { "items": [\
{\
"itemId": 1234567,\
"quantity": 3,\
"lineItemId": 3,\
"price": {\
"currency": "USD",\
"base": 15.99,\
"sale": 10.99\
},\
"priceListId": 100000012,\
"discountedQuantity": 3,\
"isUnique": "123"\
}\
] }
headers = {
"x-site-context": "<x-site-context>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)
JavaScript
const options = {
method: 'PATCH',
headers: {'x-site-context': '<x-site-context>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [\
{\
itemId: 1234567,\
quantity: 3,\
lineItemId: 3,\
price: {currency: 'USD', base: 15.99, sale: 10.99},\
priceListId: 100000012,\
discountedQuantity: 3,\
isUnique: '123'\
}\
]
})
};
fetch('https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items', 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://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items",\
CURLOPT_RETURNTRANSFER => true,\
CURLOPT_ENCODING => "",\
CURLOPT_MAXREDIRS => 10,\
CURLOPT_TIMEOUT => 30,\
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
CURLOPT_CUSTOMREQUEST => "PATCH",\
CURLOPT_POSTFIELDS => json_encode([\
'items' => [\
[\
'itemId' => 1234567,\
'quantity' => 3,\
'lineItemId' => 3,\
'price' => [\
'currency' => 'USD',\
'base' => 15.99,\
'sale' => 10.99\
],\
'priceListId' => 100000012,\
'discountedQuantity' => 3,\
'isUnique' => '123'\
]\
]\
]),\
CURLOPT_HTTPHEADER => [\
"Content-Type: application/json",\
"x-site-context: <x-site-context>"\
],\
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items"
payload := strings.NewReader("{\n \"items\": [\n {\n \"itemId\": 1234567,\n \"quantity\": 3,\n \"lineItemId\": 3,\n \"price\": {\n \"currency\": \"USD\",\n \"base\": 15.99,\n \"sale\": 10.99\n },\n \"priceListId\": 100000012,\n \"discountedQuantity\": 3,\n \"isUnique\": \"123\"\n }\n ]}\n")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-site-context", "<x-site-context>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Java
HttpResponse<String> response = Unirest.patch("https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items")
.header("x-site-context", "<x-site-context>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"itemId\": 1234567,\n \"quantity\": 3,\n \"lineItemId\": 3,\n \"price\": {\n \"currency\": \"USD\",\n \"base\": 15.99,\n \"sale\": 10.99\n },\n \"priceListId\": 100000012,\n \"discountedQuantity\": 3,\n \"isUnique\": \"123\"\n }\n ]}\n")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-site-context"] = '<x-site-context>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"itemId\": 1234567,\n \"quantity\": 3,\n \"lineItemId\": 3,\n \"price\": {\n \"currency\": \"USD\",\n \"base\": 15.99,\n \"sale\": 10.99\n },\n \"priceListId\": 100000012,\n \"discountedQuantity\": 3,\n \"isUnique\": \"123\"\n }\n ]}\n"
response = http.request(request)
puts response.read_body
Response
200
- deleted:
boolean - allPromosApplied:
object[] - items:
object[] - registeredUser:
boolean - cartId:
number - totalAmmount:
object - quantity:
number - __v:
number - attributes:
object[] - account:
string - approver:
string - po:
string - company:
string - status:
string - extra:
object - errors:
object - _id:
string - createdAt:
string - updatedAt:
string
Error messages
{
"code": "CART_NOT_FOUND",
"message": "Cart not found."
}