Validate Customer ExternalId
Check whether an ExternalId from your system can be safely projected into Azotte (i.e. not already in use by another Azotte customer record for the same tenant). Call this before store to avoid a duplicate-identifier collision.
URL
POST /api/c2a/customer/validate
Request Parameters
| Name | Type | Description |
|---|---|---|
externalId | string | Required. Tenant-side identifier to test for uniqueness within this tenant. |
Request Example
{
"externalId": "crm-9981273"
}
Response Parameters
ValidateCustomerResponse.
| Name | Type | Description |
|---|---|---|
isAvailable | boolean | true if the ExternalId is free to use. |
status | object (AzotteStatus) | Operation status envelope. |
status.messageCode | string | SUCCESS on hit. |
Sample Response
{
"isAvailable": true,
"status": { "messageCode": "SUCCESS" }
}
Sample Codes
- cURL
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
curl --location 'https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate' \
--header 'Content-Type: application/json' \
--header 'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f' \
--header 'x-api-key: sk_dev_acme_sample_123456789' \
--data '{ "externalId": "crm-9981273" }'
const res = await fetch('https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789'
},
body: JSON.stringify({ externalId: 'crm-9981273' })
});
console.log(await res.json());
import { request } from 'undici';
const { body } = await request('https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789'
},
body: JSON.stringify({ externalId: 'crm-9981273' })
});
console.log(await body.json());
import requests
res = requests.post(
'https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate',
headers={
'Content-Type': 'application/json',
'x-tn': 'e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key': 'sk_dev_acme_sample_123456789',
},
json={'externalId': 'crm-9981273'},
)
print(res.json())
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate"))
.header("Content-Type", "application/json")
.header("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f")
.header("x-api-key", "sk_dev_acme_sample_123456789")
.POST(HttpRequest.BodyPublishers.ofString("{\"externalId\":\"crm-9981273\"}"))
.build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f");
http.DefaultRequestHeaders.Add("x-api-key", "sk_dev_acme_sample_123456789");
var content = new StringContent(
"{\"externalId\":\"crm-9981273\"}",
System.Text.Encoding.UTF8,
"application/json");
var res = await http.PostAsync(
"https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate",
content);
Console.WriteLine(await res.Content.ReadAsStringAsync());
<?php
$ch = curl_init('https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'x-tn: e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f',
'x-api-key: sk_dev_acme_sample_123456789',
],
CURLOPT_POSTFIELDS => json_encode(['externalId' => 'crm-9981273']),
]);
echo curl_exec($ch);
curl_close($ch);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := bytes.NewBufferString(`{"externalId":"crm-9981273"}`)
req, _ := http.NewRequest("POST",
"https://acme.sandbox.azotte.com/api/v1/c2a/customer/validate", body)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-tn", "e2a1c7b2-4f3a-4b8e-9c2d-1a2b3c4d5e6f")
req.Header.Set("x-api-key", "sk_dev_acme_sample_123456789")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}