Update a customer
curl --request PATCH \
--url https://api.togai.com/customers/{customer_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
}
}
'import requests
url = "https://api.togai.com/customers/{customer_id}"
payload = {
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'ACME Enterprise',
primaryEmail: 'admin@example.com',
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina',
country: 'US'
}
})
};
fetch('https://api.togai.com/customers/{customer_id}', 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.togai.com/customers/{customer_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'ACME Enterprise',
'primaryEmail' => 'admin@example.com',
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina',
'country' => 'US'
]
]),
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.togai.com/customers/{customer_id}"
payload := strings.NewReader("{\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/customers/{customer_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/customers/{customer_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"togaiCustomerId": "customer.dsvvre314.dcs14",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"billingAddress": "2281 Broadway Street, G-31, 29501, Florence, South Carolina, US",
"status": "ACTIVE",
"updatedAt": "2020-07-04T12:00:00.000Z",
"createdAt": "2020-07-04T12:00:00.000Z"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Customers
Update a customer
This API let’s you to update a customer’s information using customer_id.
PATCH
/
customers
/
{customer_id}
Update a customer
curl --request PATCH \
--url https://api.togai.com/customers/{customer_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
}
}
'import requests
url = "https://api.togai.com/customers/{customer_id}"
payload = {
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'ACME Enterprise',
primaryEmail: 'admin@example.com',
address: {
phoneNumber: '+919876543210',
line1: '2281 Broadway Street',
line2: 'G-31',
postalCode: '29501',
city: 'Florence',
state: 'South Carolina',
country: 'US'
}
})
};
fetch('https://api.togai.com/customers/{customer_id}', 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.togai.com/customers/{customer_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'ACME Enterprise',
'primaryEmail' => 'admin@example.com',
'address' => [
'phoneNumber' => '+919876543210',
'line1' => '2281 Broadway Street',
'line2' => 'G-31',
'postalCode' => '29501',
'city' => 'Florence',
'state' => 'South Carolina',
'country' => 'US'
]
]),
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.togai.com/customers/{customer_id}"
payload := strings.NewReader("{\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/customers/{customer_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/customers/{customer_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"ACME Enterprise\",\n \"primaryEmail\": \"admin@example.com\",\n \"address\": {\n \"phoneNumber\": \"+919876543210\",\n \"line1\": \"2281 Broadway Street\",\n \"line2\": \"G-31\",\n \"postalCode\": \"29501\",\n \"city\": \"Florence\",\n \"state\": \"South Carolina\",\n \"country\": \"US\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "01BX5ZZKBKACTAV9WEVGEMMVRZ",
"togaiCustomerId": "customer.dsvvre314.dcs14",
"name": "ACME Enterprise",
"primaryEmail": "admin@example.com",
"address": {
"phoneNumber": "+919876543210",
"line1": "2281 Broadway Street",
"line2": "G-31",
"postalCode": "29501",
"city": "Florence",
"state": "South Carolina",
"country": "US"
},
"billingAddress": "2281 Broadway Street, G-31, 29501, Florence, South Carolina, US",
"status": "ACTIVE",
"updatedAt": "2020-07-04T12:00:00.000Z",
"createdAt": "2020-07-04T12:00:00.000Z"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Maximum string length:
50Example:
"01BX5ZZKBKACTAV9WEVGEMMVRZ"
Body
application/json
Payload to update customer
Response
Response for Get customer requests
Structure of customer
Identifier of customer
Maximum string length:
50Unique identifier of customer
Name of the Customer
Required string length:
3 - 255Primary email of the customer
Maximum string length:
320billing address of the customer
Maximum string length:
1000Example:
"201 Boulevard, WA 53123"
billing address of the customer
Show child attributes
Show child attributes
Status of the customer
Available options:
ACTIVE, ARCHIVED Example:
"ACTIVE"
⌘I
