Search for customer's addresses
curl --request POST \
--url https://api.fabric.inc/v3/customers/{customerId}/customer-address/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"match": {
"county": {
"op": "IN",
"value": "King County"
},
"latitude": {
"op": "LTE",
"value": 47.6205
},
"longitude": {
"op": "LTE",
"value": -77.0364
},
"createdAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"updatedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"deletedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"additionalAttributes": {
"op": "IN",
"key": "gps",
"value": "beach"
},
"isDeleted": false,
"isDefault": true
},
"sort": "-createdAt",
"offset": 0,
"limit": 10
}
'import requests
url = "https://api.fabric.inc/v3/customers/{customerId}/customer-address/search"
payload = {
"match": {
"county": {
"op": "IN",
"value": "King County"
},
"latitude": {
"op": "LTE",
"value": 47.6205
},
"longitude": {
"op": "LTE",
"value": -77.0364
},
"createdAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"updatedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"deletedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"additionalAttributes": {
"op": "IN",
"key": "gps",
"value": "beach"
},
"isDeleted": False,
"isDefault": True
},
"sort": "-createdAt",
"offset": 0,
"limit": 10
}
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({
match: {
county: {op: 'IN', value: 'King County'},
latitude: {op: 'LTE', value: 47.6205},
longitude: {op: 'LTE', value: -77.0364},
createdAt: {op: 'LTE', value: '2023-08-30T23:20:42.822Z'},
updatedAt: {op: 'LTE', value: '2023-08-30T23:20:42.822Z'},
deletedAt: {op: 'LTE', value: '2023-08-30T23:20:42.822Z'},
additionalAttributes: {op: 'IN', key: 'gps', value: 'beach'},
isDeleted: false,
isDefault: true
},
sort: '-createdAt',
offset: 0,
limit: 10
})
};
fetch('https://api.fabric.inc/v3/customers/{customerId}/customer-address/search', 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/{customerId}/customer-address/search",
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([
'match' => [
'county' => [
'op' => 'IN',
'value' => 'King County'
],
'latitude' => [
'op' => 'LTE',
'value' => 47.6205
],
'longitude' => [
'op' => 'LTE',
'value' => -77.0364
],
'createdAt' => [
'op' => 'LTE',
'value' => '2023-08-30T23:20:42.822Z'
],
'updatedAt' => [
'op' => 'LTE',
'value' => '2023-08-30T23:20:42.822Z'
],
'deletedAt' => [
'op' => 'LTE',
'value' => '2023-08-30T23:20:42.822Z'
],
'additionalAttributes' => [
'op' => 'IN',
'key' => 'gps',
'value' => 'beach'
],
'isDeleted' => false,
'isDefault' => true
],
'sort' => '-createdAt',
'offset' => 0,
'limit' => 10
]),
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/{customerId}/customer-address/search"
payload := strings.NewReader("{\n \"match\": {\n \"county\": {\n \"op\": \"IN\",\n \"value\": \"King County\"\n },\n \"latitude\": {\n \"op\": \"LTE\",\n \"value\": 47.6205\n },\n \"longitude\": {\n \"op\": \"LTE\",\n \"value\": -77.0364\n },\n \"createdAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"updatedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"deletedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"additionalAttributes\": {\n \"op\": \"IN\",\n \"key\": \"gps\",\n \"value\": \"beach\"\n },\n \"isDeleted\": false,\n \"isDefault\": true\n },\n \"sort\": \"-createdAt\",\n \"offset\": 0,\n \"limit\": 10\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/{customerId}/customer-address/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"match\": {\n \"county\": {\n \"op\": \"IN\",\n \"value\": \"King County\"\n },\n \"latitude\": {\n \"op\": \"LTE\",\n \"value\": 47.6205\n },\n \"longitude\": {\n \"op\": \"LTE\",\n \"value\": -77.0364\n },\n \"createdAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"updatedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"deletedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"additionalAttributes\": {\n \"op\": \"IN\",\n \"key\": \"gps\",\n \"value\": \"beach\"\n },\n \"isDeleted\": false,\n \"isDefault\": true\n },\n \"sort\": \"-createdAt\",\n \"offset\": 0,\n \"limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/customers/{customerId}/customer-address/search")
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 \"match\": {\n \"county\": {\n \"op\": \"IN\",\n \"value\": \"King County\"\n },\n \"latitude\": {\n \"op\": \"LTE\",\n \"value\": 47.6205\n },\n \"longitude\": {\n \"op\": \"LTE\",\n \"value\": -77.0364\n },\n \"createdAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"updatedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"deletedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"additionalAttributes\": {\n \"op\": \"IN\",\n \"key\": \"gps\",\n \"value\": \"beach\"\n },\n \"isDeleted\": false,\n \"isDefault\": true\n },\n \"sort\": \"-createdAt\",\n \"offset\": 0,\n \"limit\": 10\n}"
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"
}
]
}Customer Address
Search for customer's addresses
With this endpoint, you can search for customer’s addresses based on the specified filter conditions. In addition, you can tailor the search results by including or excluding the deleted addresses and the default addresses.
Note:A customer can have a default address for both billing and shipping.
POST
/
customers
/
{customerId}
/
customer-address
/
search
Search for customer's addresses
curl --request POST \
--url https://api.fabric.inc/v3/customers/{customerId}/customer-address/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"match": {
"county": {
"op": "IN",
"value": "King County"
},
"latitude": {
"op": "LTE",
"value": 47.6205
},
"longitude": {
"op": "LTE",
"value": -77.0364
},
"createdAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"updatedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"deletedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"additionalAttributes": {
"op": "IN",
"key": "gps",
"value": "beach"
},
"isDeleted": false,
"isDefault": true
},
"sort": "-createdAt",
"offset": 0,
"limit": 10
}
'import requests
url = "https://api.fabric.inc/v3/customers/{customerId}/customer-address/search"
payload = {
"match": {
"county": {
"op": "IN",
"value": "King County"
},
"latitude": {
"op": "LTE",
"value": 47.6205
},
"longitude": {
"op": "LTE",
"value": -77.0364
},
"createdAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"updatedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"deletedAt": {
"op": "LTE",
"value": "2023-08-30T23:20:42.822Z"
},
"additionalAttributes": {
"op": "IN",
"key": "gps",
"value": "beach"
},
"isDeleted": False,
"isDefault": True
},
"sort": "-createdAt",
"offset": 0,
"limit": 10
}
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({
match: {
county: {op: 'IN', value: 'King County'},
latitude: {op: 'LTE', value: 47.6205},
longitude: {op: 'LTE', value: -77.0364},
createdAt: {op: 'LTE', value: '2023-08-30T23:20:42.822Z'},
updatedAt: {op: 'LTE', value: '2023-08-30T23:20:42.822Z'},
deletedAt: {op: 'LTE', value: '2023-08-30T23:20:42.822Z'},
additionalAttributes: {op: 'IN', key: 'gps', value: 'beach'},
isDeleted: false,
isDefault: true
},
sort: '-createdAt',
offset: 0,
limit: 10
})
};
fetch('https://api.fabric.inc/v3/customers/{customerId}/customer-address/search', 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/{customerId}/customer-address/search",
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([
'match' => [
'county' => [
'op' => 'IN',
'value' => 'King County'
],
'latitude' => [
'op' => 'LTE',
'value' => 47.6205
],
'longitude' => [
'op' => 'LTE',
'value' => -77.0364
],
'createdAt' => [
'op' => 'LTE',
'value' => '2023-08-30T23:20:42.822Z'
],
'updatedAt' => [
'op' => 'LTE',
'value' => '2023-08-30T23:20:42.822Z'
],
'deletedAt' => [
'op' => 'LTE',
'value' => '2023-08-30T23:20:42.822Z'
],
'additionalAttributes' => [
'op' => 'IN',
'key' => 'gps',
'value' => 'beach'
],
'isDeleted' => false,
'isDefault' => true
],
'sort' => '-createdAt',
'offset' => 0,
'limit' => 10
]),
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/{customerId}/customer-address/search"
payload := strings.NewReader("{\n \"match\": {\n \"county\": {\n \"op\": \"IN\",\n \"value\": \"King County\"\n },\n \"latitude\": {\n \"op\": \"LTE\",\n \"value\": 47.6205\n },\n \"longitude\": {\n \"op\": \"LTE\",\n \"value\": -77.0364\n },\n \"createdAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"updatedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"deletedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"additionalAttributes\": {\n \"op\": \"IN\",\n \"key\": \"gps\",\n \"value\": \"beach\"\n },\n \"isDeleted\": false,\n \"isDefault\": true\n },\n \"sort\": \"-createdAt\",\n \"offset\": 0,\n \"limit\": 10\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/{customerId}/customer-address/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"match\": {\n \"county\": {\n \"op\": \"IN\",\n \"value\": \"King County\"\n },\n \"latitude\": {\n \"op\": \"LTE\",\n \"value\": 47.6205\n },\n \"longitude\": {\n \"op\": \"LTE\",\n \"value\": -77.0364\n },\n \"createdAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"updatedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"deletedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"additionalAttributes\": {\n \"op\": \"IN\",\n \"key\": \"gps\",\n \"value\": \"beach\"\n },\n \"isDeleted\": false,\n \"isDefault\": true\n },\n \"sort\": \"-createdAt\",\n \"offset\": 0,\n \"limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/customers/{customerId}/customer-address/search")
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 \"match\": {\n \"county\": {\n \"op\": \"IN\",\n \"value\": \"King County\"\n },\n \"latitude\": {\n \"op\": \"LTE\",\n \"value\": 47.6205\n },\n \"longitude\": {\n \"op\": \"LTE\",\n \"value\": -77.0364\n },\n \"createdAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"updatedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"deletedAt\": {\n \"op\": \"LTE\",\n \"value\": \"2023-08-30T23:20:42.822Z\"\n },\n \"additionalAttributes\": {\n \"op\": \"IN\",\n \"key\": \"gps\",\n \"value\": \"beach\"\n },\n \"isDeleted\": false,\n \"isDefault\": true\n },\n \"sort\": \"-createdAt\",\n \"offset\": 0,\n \"limit\": 10\n}"
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"
}
]
}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"
Path Parameters
Body
application/json
A sample request to search for the customer's addresses.
The criteria to search for customer's addresses.
Was this page helpful?
