Get customer's address - Fabric
Get customer's address
cURL
curl --request GET \
--url https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId} \
--header 'Authorization: Bearer <token>'
Python
import requests
url = "https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId}",
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;
}
?>
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId}"
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))
}
Unirest (Java)
HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId}")
.header("Authorization", "Bearer <token>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/customers/{customerId}/customer-address/{addressId}")
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
Response
200
Example
{
"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"
}
Authorizations
Authorization
- Type: string
- Required: Yes
- Description: The access token.
Headers
- x-fabric-tenant-id: string - A header used by fabric to identify the tenant making the request. Required.
Path Parameters
- customerId: string (required) - A 24-character system-generated ID.
- addressId: string (required) - A 24-character system-generated ID of the customer's address.
Response Schema
- id: string (required) - A 24-character ID of the address.
- address: object (required) - The address details.
- isDeleted: boolean (required) - Flag indicating whether the address is deleted.
- createdAt: string
(required) - Creation time in UTC format. - updatedAt: string
| null (required) - Last updated time in UTC format. - additionalAttributes: object - Additional info in key-value pairs.
- isDefault: boolean - Flag indicating if the address is the default one.
- deletedAt: string
| null - Time when the address was deleted.