Add address - customer context.
curl --request POST \
--url https://api.fabric.inc/v3/customers/self/customer-address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": {
"type": "BILLING",
"addressLine1": "123 Main St.",
"addressLine2": "Suite 100",
"addressLine3": "Seventh floor",
"addressLine4": "Attention: Pat E. Doe",
"city": "Seattle",
"region": "WA",
"postalCode": 98121,
"county": "King County",
"country": "US",
"latitude": 47.6205,
"longitude": -122.3493
},
"isDefault": false,
"additionalAttributes": {
"landmark": "Beach"
}
}
'import requests
url = "https://api.fabric.inc/v3/customers/self/customer-address"
payload = {
"address": {
"type": "BILLING",
"addressLine1": "123 Main St.",
"addressLine2": "Suite 100",
"addressLine3": "Seventh floor",
"addressLine4": "Attention: Pat E. Doe",
"city": "Seattle",
"region": "WA",
"postalCode": 98121,
"county": "King County",
"country": "US",
"latitude": 47.6205,
"longitude": -122.3493
},
"isDefault": False,
"additionalAttributes": { "landmark": "Beach" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: {
type: 'BILLING',
addressLine1: '123 Main St.',
addressLine2: 'Suite 100',
addressLine3: 'Seventh floor',
addressLine4: 'Attention: Pat E. Doe',
city: 'Seattle',
region: 'WA',
postalCode: 98121,
county: 'King County',
country: 'US',
latitude: 47.6205,
longitude: -122.3493
},
isDefault: false,
additionalAttributes: {landmark: 'Beach'}
})
};
fetch('https://api.fabric.inc/v3/customers/self/customer-address', 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/customers/self/customer-address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => [
'type' => 'BILLING',
'addressLine1' => '123 Main St.',
'addressLine2' => 'Suite 100',
'addressLine3' => 'Seventh floor',
'addressLine4' => 'Attention: Pat E. Doe',
'city' => 'Seattle',
'region' => 'WA',
'postalCode' => 98121,
'county' => 'King County',
'country' => 'US',
'latitude' => 47.6205,
'longitude' => -122.3493
],
'isDefault' => false,
'additionalAttributes' => [
'landmark' => 'Beach'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/customers/self/customer-address"
payload := strings.NewReader("{\n \"address\": {\n \"type\": \"BILLING\",\n \"addressLine1\": \"123 Main St.\",\n \"addressLine2\": \"Suite 100\",\n \"addressLine3\": \"Seventh floor\",\n \"addressLine4\": \"Attention: Pat E. Doe\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"postalCode\": 98121,\n \"county\": \"King County\",\n \"country\": \"US\",\n \"latitude\": 47.6205,\n \"longitude\": -122.3493\n },\n \"isDefault\": false,\n \"additionalAttributes\": {\n \"landmark\": \"Beach\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.fabric.inc/v3/customers/self/customer-address")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": {\n \"type\": \"BILLING\",\n \"addressLine1\": \"123 Main St.\",\n \"addressLine2\": \"Suite 100\",\n \"addressLine3\": \"Seventh floor\",\n \"addressLine4\": \"Attention: Pat E. Doe\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"postalCode\": 98121,\n \"county\": \"King County\",\n \"country\": \"US\",\n \"latitude\": 47.6205,\n \"longitude\": -122.3493\n },\n \"isDefault\": false,\n \"additionalAttributes\": {\n \"landmark\": \"Beach\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/customers/self/customer-address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": {\n \"type\": \"BILLING\",\n \"addressLine1\": \"123 Main St.\",\n \"addressLine2\": \"Suite 100\",\n \"addressLine3\": \"Seventh floor\",\n \"addressLine4\": \"Attention: Pat E. Doe\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"postalCode\": 98121,\n \"county\": \"King County\",\n \"country\": \"US\",\n \"latitude\": 47.6205,\n \"longitude\": -122.3493\n },\n \"isDefault\": false,\n \"additionalAttributes\": {\n \"landmark\": \"Beach\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "61604a30fdfacd0009816e44",
"address": {
"type": "BILLING",
"addressLine1": "123 Main St.",
"addressLine2": "Suite 100",
"addressLine3": "Seventh floor",
"addressLine4": "Attention: Pat E. Doe",
"city": "Seattle",
"region": "WA",
"postalCode": 98121,
"county": "King County",
"country": "US",
"latitude": 47.6205,
"longitude": -122.3493
},
"isDeleted": false,
"createdAt": "2023-08-30T23:20:42.822Z",
"updatedAt": "2023-08-30T23:20:42.822Z",
"additionalAttributes": {
"landmark": "Beach"
},
"isDefault": false,
"deletedAt": "2023-08-30T23:20:42.822Z"
}{
"type": "INVALID_ACCOUNT_PROVIDED",
"message": "Invalid account provided for the request."
}{
"type": "REQUEST_DENIED",
"message": "Forbidden"
}{
"type": "CUSTOMER_NOT_FOUND",
"message": "Data with the given identifier isn't found"
}{
"type": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
}Customer Self
Add address - customer context.
Using this endpoint, a customer can add their address through a storefront UI.
POST
/
customers
/
self
/
customer-address
Add address - customer context.
curl --request POST \
--url https://api.fabric.inc/v3/customers/self/customer-address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": {
"type": "BILLING",
"addressLine1": "123 Main St.",
"addressLine2": "Suite 100",
"addressLine3": "Seventh floor",
"addressLine4": "Attention: Pat E. Doe",
"city": "Seattle",
"region": "WA",
"postalCode": 98121,
"county": "King County",
"country": "US",
"latitude": 47.6205,
"longitude": -122.3493
},
"isDefault": false,
"additionalAttributes": {
"landmark": "Beach"
}
}
'import requests
url = "https://api.fabric.inc/v3/customers/self/customer-address"
payload = {
"address": {
"type": "BILLING",
"addressLine1": "123 Main St.",
"addressLine2": "Suite 100",
"addressLine3": "Seventh floor",
"addressLine4": "Attention: Pat E. Doe",
"city": "Seattle",
"region": "WA",
"postalCode": 98121,
"county": "King County",
"country": "US",
"latitude": 47.6205,
"longitude": -122.3493
},
"isDefault": False,
"additionalAttributes": { "landmark": "Beach" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: {
type: 'BILLING',
addressLine1: '123 Main St.',
addressLine2: 'Suite 100',
addressLine3: 'Seventh floor',
addressLine4: 'Attention: Pat E. Doe',
city: 'Seattle',
region: 'WA',
postalCode: 98121,
county: 'King County',
country: 'US',
latitude: 47.6205,
longitude: -122.3493
},
isDefault: false,
additionalAttributes: {landmark: 'Beach'}
})
};
fetch('https://api.fabric.inc/v3/customers/self/customer-address', 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/customers/self/customer-address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => [
'type' => 'BILLING',
'addressLine1' => '123 Main St.',
'addressLine2' => 'Suite 100',
'addressLine3' => 'Seventh floor',
'addressLine4' => 'Attention: Pat E. Doe',
'city' => 'Seattle',
'region' => 'WA',
'postalCode' => 98121,
'county' => 'King County',
'country' => 'US',
'latitude' => 47.6205,
'longitude' => -122.3493
],
'isDefault' => false,
'additionalAttributes' => [
'landmark' => 'Beach'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/customers/self/customer-address"
payload := strings.NewReader("{\n \"address\": {\n \"type\": \"BILLING\",\n \"addressLine1\": \"123 Main St.\",\n \"addressLine2\": \"Suite 100\",\n \"addressLine3\": \"Seventh floor\",\n \"addressLine4\": \"Attention: Pat E. Doe\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"postalCode\": 98121,\n \"county\": \"King County\",\n \"country\": \"US\",\n \"latitude\": 47.6205,\n \"longitude\": -122.3493\n },\n \"isDefault\": false,\n \"additionalAttributes\": {\n \"landmark\": \"Beach\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.fabric.inc/v3/customers/self/customer-address")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": {\n \"type\": \"BILLING\",\n \"addressLine1\": \"123 Main St.\",\n \"addressLine2\": \"Suite 100\",\n \"addressLine3\": \"Seventh floor\",\n \"addressLine4\": \"Attention: Pat E. Doe\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"postalCode\": 98121,\n \"county\": \"King County\",\n \"country\": \"US\",\n \"latitude\": 47.6205,\n \"longitude\": -122.3493\n },\n \"isDefault\": false,\n \"additionalAttributes\": {\n \"landmark\": \"Beach\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/customers/self/customer-address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": {\n \"type\": \"BILLING\",\n \"addressLine1\": \"123 Main St.\",\n \"addressLine2\": \"Suite 100\",\n \"addressLine3\": \"Seventh floor\",\n \"addressLine4\": \"Attention: Pat E. Doe\",\n \"city\": \"Seattle\",\n \"region\": \"WA\",\n \"postalCode\": 98121,\n \"county\": \"King County\",\n \"country\": \"US\",\n \"latitude\": 47.6205,\n \"longitude\": -122.3493\n },\n \"isDefault\": false,\n \"additionalAttributes\": {\n \"landmark\": \"Beach\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "61604a30fdfacd0009816e44",
"address": {
"type": "BILLING",
"addressLine1": "123 Main St.",
"addressLine2": "Suite 100",
"addressLine3": "Seventh floor",
"addressLine4": "Attention: Pat E. Doe",
"city": "Seattle",
"region": "WA",
"postalCode": 98121,
"county": "King County",
"country": "US",
"latitude": 47.6205,
"longitude": -122.3493
},
"isDeleted": false,
"createdAt": "2023-08-30T23:20:42.822Z",
"updatedAt": "2023-08-30T23:20:42.822Z",
"additionalAttributes": {
"landmark": "Beach"
},
"isDefault": false,
"deletedAt": "2023-08-30T23:20:42.822Z"
}{
"type": "INVALID_ACCOUNT_PROVIDED",
"message": "Invalid account provided for the request."
}{
"type": "REQUEST_DENIED",
"message": "Forbidden"
}{
"type": "CUSTOMER_NOT_FOUND",
"message": "Data with the given identifier isn't found"
}{
"type": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
}Headers
A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.
Example:
"517fa9dfd42d8b00g1o3k312"
Body
application/json
A sample request body to add address.
Response
OK
Was this page helpful?
