Get Contact State
curl --request GET \
--url 'http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}'import requests
url = "http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}', 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 => "http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"displays": [
{
"createdAt": "2024-04-23T08:59:37.550Z",
"surveyId": "pjogp5a1wyxon6umplmf49b8"
}
],
"lastDisplayAt": "2024-04-23T08:59:37.550Z",
"responses": [
"pjogp5a1wyxon6umplmf49b8"
],
"segments": [
"fi8f9oekza95wwszrptidivq",
"zgwrv8eg7vfavdhzv1s0po1w"
],
"userId": "user-123"
}{
"code": "forbidden",
"message": "User identification is only available for enterprise users."
}{
"code": "not_found",
"details": {
"resource_id": "tpywklouw2p7tebdu4zv01an",
"resource_type": "environment"
},
"message": "Environment not found"
}{
"code": "internal_server_error",
"details": {},
"message": "Unable to complete request: Expected property name or '}' in JSON at position 29"
}Client API > Contacts
Get Contact State
Retrieves a contact’s state including their segments, displays, responses and other tracking information. If the contact doesn’t exist, it will be created.
GET
/
api
/
v1
/
client
/
{environmentId}
/
identify
/
contacts
/
{userId}
Get Contact State
curl --request GET \
--url 'http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}'import requests
url = "http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}', 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 => "http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{{baseurl}}/api/v1/client/{environmentId}/identify/contacts/{userId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"displays": [
{
"createdAt": "2024-04-23T08:59:37.550Z",
"surveyId": "pjogp5a1wyxon6umplmf49b8"
}
],
"lastDisplayAt": "2024-04-23T08:59:37.550Z",
"responses": [
"pjogp5a1wyxon6umplmf49b8"
],
"segments": [
"fi8f9oekza95wwszrptidivq",
"zgwrv8eg7vfavdhzv1s0po1w"
],
"userId": "user-123"
}{
"code": "forbidden",
"message": "User identification is only available for enterprise users."
}{
"code": "not_found",
"details": {
"resource_id": "tpywklouw2p7tebdu4zv01an",
"resource_type": "environment"
},
"message": "Environment not found"
}{
"code": "internal_server_error",
"details": {},
"message": "Unable to complete request: Expected property name or '}' in JSON at position 29"
}Was this page helpful?
⌘I