Get ShipTo by ID - Fabric
Get ShipTo by ID
cURL
curl --request GET \
--url https://prod01-apigw.yourcompany.fabric.zone/api-cart/ship-to/{shipTo} \
--header 'x-site-context: <x-site-context>'
Python
import requests
url = "https://prod01-apigw.yourcompany.fabric.zone/api-cart/ship-to/{shipTo}"
headers = {"x-site-context": "<x-site-context>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {method: 'GET', headers: {'x-site-context': '<x-site-context>'}};
fetch('https://prod01-apigw.yourcompany.fabric.zone/api-cart/ship-to/{shipTo}', 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/ship-to/{shipTo}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://prod01-apigw.yourcompany.fabric.zone/api-cart/ship-to/{shipTo}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-site-context", "<x-site-context>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Unirest (Java)
HttpResponse<String> response = Unirest.get("https://prod01-apigw.yourcompany.fabric.zone/api-cart/ship-to/{shipTo}")
.header("x-site-context", "<x-site-context>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://prod01-apigw.yourcompany.fabric.zone/api-cart/ship-to/{shipTo}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-site-context"] = '<x-site-context>'
response = http.request(request)
puts response.read_body
Response Examples
Successful Response (200)
{
"shipToType": "SHIP_TO_ADDRESS",
"warehouseId": "123456abcdef123456abcdef",
"isPickup": true,
"shipMethod": {
"shipMethodId": "1a2b3c4d5e6f7g8h9i0j",
"cost": {
"currency": "USD",
"amount": 5.99
},
"shipmentCarrier": "Fedex",
"shipmentMethod": "Next Day"
},
"taxCode": "FR1000",
"storeId": "TBD",
"pickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"phone": {
"number": "123-456-7890",
"kind": "Mobile"
},
"email": "johnsmith@fabric.inc"
},
"altPickupPerson": {
"name": {
"first": "John",
"last": "Smith"
},
"phone": {
"number": "123-456-7890",
"kind": "Mobile"
},
"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
}
Not Found Response (404)
{
"code": "SHIPTO_NOT_FOUND",
"message": "Ship-to not found."
}
Headers
x-site-context
- Type: string
- Required: Yes
- Description: The
x-site-context header is a JSON object required for API calls. It includes mandatory account, channel, stage, and date attributes.