Update ship-to
cURL
curl --request PATCH \
--url https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/ship-to/{shipToId} \
--header 'Content-Type: application/json' \
--header 'x-site-context: <x-site-context>' \
--data '
{
"shipToType": "SHIP_TO_ADDRESS",
"warehouseId": "123456abcdef123456abcdef",
"isPickup": true,
"taxCode": "FR1000",
"storeId": "TBD",
"pickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"email": "johnsmith@fabric.inc"
},
"altPickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"email": "johnsmith@fabric.inc"
},
"address": "<unknown>"
}
'
Python Example
import requests
url = "https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/ship-to/{shipToId}"
payload = {
"shipToType": "SHIP_TO_ADDRESS",
"warehouseId": "123456abcdef123456abcdef",
"isPickup": True,
"taxCode": "FR1000",
"storeId": "TBD",
"pickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"email": "johnsmith@fabric.inc"
},
"altPickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"email": "johnsmith@fabric.inc"
},
"address": "<unknown>"
}
headers = {
"x-site-context": "<x-site-context>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)
JavaScript Example
const options = {
method: 'PATCH',
headers: {'x-site-context': '<x-site-context>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipToType: 'SHIP_TO_ADDRESS',
warehouseId: '123456abcdef123456abcdef',
isPickup: true,
taxCode: 'FR1000',
storeId: 'TBD',
pickupPerson: {name: {first: 'John', last: 'Smith'}, email: 'johnsmith@fabric.inc'},
altPickupPerson: {name: {first: 'John', last: 'Smith'}, email: 'johnsmith@fabric.inc'},
address: '<unknown>'
})
};
fetch('https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/ship-to/{shipToId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP Example
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod01-apigw.yourcompany.fabric.zone/api-cart/cart/{cartId}/ship-to/{shipToId}",
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([
'shipToType' => 'SHIP_TO_ADDRESS',
'warehouseId' => '123456abcdef123456abcdef',
'isPickup' => true,
'taxCode' => 'FR1000',
'storeId' => 'TBD',
'pickupPerson' => [
'name' => [
'first' => 'John',
'last' => 'Smith'
],
'email' => 'johnsmith@fabric.inc'
],
'altPickupPerson' => [
'name' => [
'first' => 'John',
'last' => 'Smith'
],
'email' => 'johnsmith@fabric.inc'
],
'address' => '<unknown>'
]),
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;
}
?>
Response Structure
{
"shipToType": "SHIP_TO_ADDRESS",
"warehouseId": "123456abcdef123456abcdef",
"isPickup": true,
"taxCode": "FR1000",
"storeId": "TBD",
"pickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"email": "johnsmith@fabric.inc"
},
"altPickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"email": "johnsmith@fabric.inc"
},
"address": "<unknown>",
"cartId": "5e5818a84d030c206b2ffb02",
"shipToId": 13812,
"_id": "5fee9d59f2f08a1b3cbdea08",
"createdAt": "2020-12-31T02:09:53.914Z",
"updatedAt": "2020-12-31T02:09:53.914Z",
"__v": 0
}
Error Response
{
"code": "CART_NOT_FOUND",
"message": "Cart not found."
}
Headers Definitions
x-site-context: This is a required header containing information about the source you wish to pull from.