Update customer
curl --request PUT \
--url https://{subdomain}.truust.io/2.0/customers/{uuid} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Name Test",
"email": "john@example.com"
}
'import requests
url = "https://{subdomain}.truust.io/2.0/customers/{uuid}"
payload = {
"name": "Name Test",
"email": "john@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Name Test', email: 'john@example.com'})
};
fetch('https://{subdomain}.truust.io/2.0/customers/{uuid}', 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://{subdomain}.truust.io/2.0/customers/{uuid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Name Test',
'email' => 'john@example.com'
]),
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://{subdomain}.truust.io/2.0/customers/{uuid}"
payload := strings.NewReader("{\n \"name\": \"Name Test\",\n \"email\": \"john@example.com\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://{subdomain}.truust.io/2.0/customers/{uuid}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Name Test\",\n \"email\": \"john@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/customers/{uuid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Name Test\",\n \"email\": \"john@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/customers/abc123",
"uuid": "<string>",
"type": "<string>",
"name": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"prefix": "+34",
"phone": "<string>",
"tag": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Customers
Update Customer
PUT
/
customers
/
{uuid}
Update customer
curl --request PUT \
--url https://{subdomain}.truust.io/2.0/customers/{uuid} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Name Test",
"email": "john@example.com"
}
'import requests
url = "https://{subdomain}.truust.io/2.0/customers/{uuid}"
payload = {
"name": "Name Test",
"email": "john@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Name Test', email: 'john@example.com'})
};
fetch('https://{subdomain}.truust.io/2.0/customers/{uuid}', 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://{subdomain}.truust.io/2.0/customers/{uuid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Name Test',
'email' => 'john@example.com'
]),
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://{subdomain}.truust.io/2.0/customers/{uuid}"
payload := strings.NewReader("{\n \"name\": \"Name Test\",\n \"email\": \"john@example.com\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://{subdomain}.truust.io/2.0/customers/{uuid}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Name Test\",\n \"email\": \"john@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/customers/{uuid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Name Test\",\n \"email\": \"john@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/customers/abc123",
"uuid": "<string>",
"type": "<string>",
"name": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"prefix": "+34",
"phone": "<string>",
"tag": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Authorizations
Use your account's Secret Key as the Bearer token.
Path Parameters
Customer UUID.
Body
application/json
Maximum string length:
255Example:
"John Doe"
Maximum string length:
255Example:
"John"
Maximum string length:
255Example:
"Doe"
Maximum string length:
255Phone country prefix (e.g. +34).
Example:
"+34"
Example:
"612345678"
Customer's preferred locale.
Example:
"es"
Maximum string length:
100Response
Updated customer
Example:
"/2.0/customers/abc123"
Example:
"+34"
Hypermedia links to related resources.
Show child attributes
Show child attributes
⌘I
