Criar asserção
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/identity/assertions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"handles": [
{
"type": "phone_e164",
"value": "+14155550123"
},
{
"type": "system_id",
"value": "48213",
"scope": "crm"
}
],
"method": "system_import",
"subject_kind": "person",
"reason": "CRM contact record 48213"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/identity/assertions"
payload = {
"handles": [
{
"type": "phone_e164",
"value": "+14155550123"
},
{
"type": "system_id",
"value": "48213",
"scope": "crm"
}
],
"method": "system_import",
"subject_kind": "person",
"reason": "CRM contact record 48213"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
handles: [
{type: 'phone_e164', value: '+14155550123'},
{type: 'system_id', value: '48213', scope: 'crm'}
],
method: 'system_import',
subject_kind: 'person',
reason: 'CRM contact record 48213'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/identity/assertions', 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://{space}.{region}.api.niadra.com/v1/identity/assertions",
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([
'handles' => [
[
'type' => 'phone_e164',
'value' => '+14155550123'
],
[
'type' => 'system_id',
'value' => '48213',
'scope' => 'crm'
]
],
'method' => 'system_import',
'subject_kind' => 'person',
'reason' => 'CRM contact record 48213'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://{space}.{region}.api.niadra.com/v1/identity/assertions"
payload := strings.NewReader("{\n \"handles\": [\n {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n {\n \"type\": \"system_id\",\n \"value\": \"48213\",\n \"scope\": \"crm\"\n }\n ],\n \"method\": \"system_import\",\n \"subject_kind\": \"person\",\n \"reason\": \"CRM contact record 48213\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://{space}.{region}.api.niadra.com/v1/identity/assertions")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"handles\": [\n {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n {\n \"type\": \"system_id\",\n \"value\": \"48213\",\n \"scope\": \"crm\"\n }\n ],\n \"method\": \"system_import\",\n \"subject_kind\": \"person\",\n \"reason\": \"CRM contact record 48213\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/identity/assertions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"handles\": [\n {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n {\n \"type\": \"system_id\",\n \"value\": \"48213\",\n \"scope\": \"crm\"\n }\n ],\n \"method\": \"system_import\",\n \"subject_kind\": \"person\",\n \"reason\": \"CRM contact record 48213\"\n}"
response = http.request(request)
puts response.read_body{
"op_id": "0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e07",
"status": "queued",
"assertion_id": "0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e06",
"link_id": null
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Identidade e perfis
Criar asserção
Afirma que dois handles são do mesmo sujeito, com método e evidência.
POST
/
v1
/
identity
/
assertions
Criar asserção
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/identity/assertions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"handles": [
{
"type": "phone_e164",
"value": "+14155550123"
},
{
"type": "system_id",
"value": "48213",
"scope": "crm"
}
],
"method": "system_import",
"subject_kind": "person",
"reason": "CRM contact record 48213"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/identity/assertions"
payload = {
"handles": [
{
"type": "phone_e164",
"value": "+14155550123"
},
{
"type": "system_id",
"value": "48213",
"scope": "crm"
}
],
"method": "system_import",
"subject_kind": "person",
"reason": "CRM contact record 48213"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
handles: [
{type: 'phone_e164', value: '+14155550123'},
{type: 'system_id', value: '48213', scope: 'crm'}
],
method: 'system_import',
subject_kind: 'person',
reason: 'CRM contact record 48213'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/identity/assertions', 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://{space}.{region}.api.niadra.com/v1/identity/assertions",
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([
'handles' => [
[
'type' => 'phone_e164',
'value' => '+14155550123'
],
[
'type' => 'system_id',
'value' => '48213',
'scope' => 'crm'
]
],
'method' => 'system_import',
'subject_kind' => 'person',
'reason' => 'CRM contact record 48213'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://{space}.{region}.api.niadra.com/v1/identity/assertions"
payload := strings.NewReader("{\n \"handles\": [\n {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n {\n \"type\": \"system_id\",\n \"value\": \"48213\",\n \"scope\": \"crm\"\n }\n ],\n \"method\": \"system_import\",\n \"subject_kind\": \"person\",\n \"reason\": \"CRM contact record 48213\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://{space}.{region}.api.niadra.com/v1/identity/assertions")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"handles\": [\n {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n {\n \"type\": \"system_id\",\n \"value\": \"48213\",\n \"scope\": \"crm\"\n }\n ],\n \"method\": \"system_import\",\n \"subject_kind\": \"person\",\n \"reason\": \"CRM contact record 48213\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/identity/assertions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"handles\": [\n {\n \"type\": \"phone_e164\",\n \"value\": \"+14155550123\"\n },\n {\n \"type\": \"system_id\",\n \"value\": \"48213\",\n \"scope\": \"crm\"\n }\n ],\n \"method\": \"system_import\",\n \"subject_kind\": \"person\",\n \"reason\": \"CRM contact record 48213\"\n}"
response = http.request(request)
puts response.read_body{
"op_id": "0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e07",
"status": "queued",
"assertion_id": "0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e06",
"link_id": null
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Autorizações
sourceKeypersonToken
nia_sk_...
Cabeçalhos
Obrigatório. Fica guardado 24 horas com o hash do corpo: repetir com a mesma chave devolve a primeira resposta, e a mesma chave com outro corpo devolve 409 conflict.
Required string length:
1 - 256Corpo
application/json
Required array length:
2 elementsShow child attributes
Show child attributes
Como a ligação entre dois handles foi estabelecida.
Opções disponíveis:
explicit_identify, otp, login, system_import, same_event, co_occurrence, channel_rotation, accepted_suggestion, external_resolver, declared Required string length:
1 - 500Uma pessoa, uma organização cliente (account) ou uma organização que participa sem ser cliente (partner).
Opções disponíveis:
person, account, partner 
