Get customers - Fabric

Get customers

cURL

curl --request GET \
  --url 'https://api.fabric.inc/v3/Customers?limit=10' \
  --header 'Authorization: Bearer <token>'

Python

import requests

url = "https://api.fabric.inc/v3/Customers?limit=10"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript

const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.fabric.inc/v3/Customers?limit=10', 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?limit=10",\
  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?limit=10"

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

HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/Customers?limit=10")
  .header("Authorization", "Bearer <token>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/Customers?limit=10")

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 Codes

JSON Response Example

{
  "query": {
    "offset": 0,
    "limit": 20,
    "count": 100
  },
  "data": [
    {
      "id": "61df41892bf06d00092d0d8a",
      "name": {
        "firstName": "Pat",
        "lastName": "Doe",
        "title": "Dr.",
        "middleName": "E",
        "suffix": "Jr."
      },
      "emailAddress": "test@example.com",
      "isDeleted": false,
      "createdAt": "2023-08-30T23:20:42.822Z",
      "updatedAt": "2023-08-30T23:20:42.822Z",
      "status": "ACTIVE",
      "phone": {
        "number": 15555551234,
        "type": "MOBILE"
      },
      "externalId": "1231012312-312-31231asda",
      "additionalAttributes": {
        "middleName": "user"
      },
      "deletedAt": "2023-08-30T23:20:42.822Z"
    }
  ]
}

Error Responses

{
  "type": "INVALID_ACCOUNT_PROVIDED",
  "message": "Invalid account provided for the request."
}
{
  "type": "REQUEST_DENIED",
  "message": "Forbidden"
}
{
  "type": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error"
}

Authorizations

Query Parameters