Update customer status - Fabric
Update customer status
cURL
curl --request POST \
--url https://api.fabric.inc/v3/customers/{customerId}/actions/update-status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "ACTIVE"
}
'
Python
import requests
url = "https://api.fabric.inc/v3/customers/{customerId}/actions/update-status"
payload = { "status": "ACTIVE" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'ACTIVE'})
};
fetch('https://api.fabric.inc/v3/customers/{customerId}/actions/update-status', 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}/actions/update-status",\
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([\
'status' => 'ACTIVE'\
]),\
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;
}
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fabric.inc/v3/customers/{customerId}/actions/update-status"
payload := strings.NewReader("{\n \"status\": \"ACTIVE\"\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))
}
Java (Unirest)
HttpResponse<String> response = Unirest.post("https://api.fabric.inc/v3/customers/{customerId}/actions/update-status")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"ACTIVE\"\n}")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.fabric.inc/v3/customers/{customerId}/actions/update-status")
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 \"status\": \"ACTIVE\"\n}"
response = http.request(request)
puts response.read_body
Response
{
"type": "CUSTOMER_STATUS_UPDATE_SUCCESS",
"message": "Customer status updated successfully",
"status": "ACTIVE"
}
Authorizations
- Authorization: string, required in header, bearer token needed.
Headers
- x-fabric-tenant-id: string, required, identifies the tenant.
- x-fabric-request-id: string, optional, a UUID for the request.
Path Parameters
- customerId: string, required, 24-char system-generated ID.
Body
- status: enum, required, available options:
ACTIVE, INACTIVE, BLOCKED.
Response
- type: string, required, machine-readable code.
- message: string, required, human-readable message.
- status: enum, required, options:
ACTIVE, INACTIVE, BLOCKED.