curl --request GET \
--url https://api.fabric.inc/v3/customers/self/customer-address \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fabric.inc/v3/customers/self/customer-address"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/customers/self/customer-address"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/customers/self/customer-address")
.header("Authorization", "Bearer <token>")
.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::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"query": {
"offset": 0,
"limit": 20,
"count": 100
},
"data": [
{
"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"
}View addresses - customer context
Using this endpoint, a customer can view their own addresses through the storefront UI.
curl --request GET \
--url https://api.fabric.inc/v3/customers/self/customer-address \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fabric.inc/v3/customers/self/customer-address"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/customers/self/customer-address"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/customers/self/customer-address")
.header("Authorization", "Bearer <token>")
.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::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"query": {
"offset": 0,
"limit": 20,
"count": 100
},
"data": [
{
"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"
}Authorizations
The access token.
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.
"517fa9dfd42d8b00g1o3k312"
A UUID of the request.
Query Parameters
The number of records to skip before returning records. For example, when offset is 20 and limit's 10, this endpoint returns records from 21 to 30.
0
The maximum number of records in a single page.
10
The criteria to sort results, where - indicates a descending order and + indicates an ascending order. You can sort the following fields - updatedAt, country, city, and region.
"-updatedAt"
A flag indicating whether only the deleted addresses are returned in the response. Specify true to get only the deleted addresses and false to get only the non-deleted ones.
false, true false
Was this page helpful?
