Update a Person
curl --request POST \
--url https://api.affinity.co/v2/persons/{personId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.doe@northpointvc.com",
"emailAddresses": [
"jane.doe@northpointvc.com",
"janedoe@gmail.com"
],
"fields": [
{
"id": "affinity-data-location",
"value": {
"type": "company-multi",
"data": [
{
"id": 1
},
{
"id": 2
}
]
}
}
]
}
'import requests
url = "https://api.affinity.co/v2/persons/{personId}"
payload = {
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.doe@northpointvc.com",
"emailAddresses": ["jane.doe@northpointvc.com", "janedoe@gmail.com"],
"fields": [
{
"id": "affinity-data-location",
"value": {
"type": "company-multi",
"data": [{ "id": 1 }, { "id": 2 }]
}
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: 'Jane',
lastName: 'Doe',
primaryEmailAddress: 'jane.doe@northpointvc.com',
emailAddresses: ['jane.doe@northpointvc.com', 'janedoe@gmail.com'],
fields: [
{
id: 'affinity-data-location',
value: {type: 'company-multi', data: [{id: 1}, {id: 2}]}
}
]
})
};
fetch('https://api.affinity.co/v2/persons/{personId}', 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.affinity.co/v2/persons/{personId}",
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([
'firstName' => 'Jane',
'lastName' => 'Doe',
'primaryEmailAddress' => 'jane.doe@northpointvc.com',
'emailAddresses' => [
'jane.doe@northpointvc.com',
'janedoe@gmail.com'
],
'fields' => [
[
'id' => 'affinity-data-location',
'value' => [
'type' => 'company-multi',
'data' => [
[
'id' => 1
],
[
'id' => 2
]
]
]
]
]
]),
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.affinity.co/v2/persons/{personId}"
payload := strings.NewReader("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"primaryEmailAddress\": \"jane.doe@northpointvc.com\",\n \"emailAddresses\": [\n \"jane.doe@northpointvc.com\",\n \"janedoe@gmail.com\"\n ],\n \"fields\": [\n {\n \"id\": \"affinity-data-location\",\n \"value\": {\n \"type\": \"company-multi\",\n \"data\": [\n {\n \"id\": 1\n },\n {\n \"id\": 2\n }\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.affinity.co/v2/persons/{personId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"primaryEmailAddress\": \"jane.doe@northpointvc.com\",\n \"emailAddresses\": [\n \"jane.doe@northpointvc.com\",\n \"janedoe@gmail.com\"\n ],\n \"fields\": [\n {\n \"id\": \"affinity-data-location\",\n \"value\": {\n \"type\": \"company-multi\",\n \"data\": [\n {\n \"id\": 1\n },\n {\n \"id\": 2\n }\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/persons/{personId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"primaryEmailAddress\": \"jane.doe@northpointvc.com\",\n \"emailAddresses\": [\n \"jane.doe@northpointvc.com\",\n \"janedoe@gmail.com\"\n ],\n \"fields\": [\n {\n \"id\": \"affinity-data-location\",\n \"value\": {\n \"type\": \"company-multi\",\n \"data\": [\n {\n \"id\": 1\n },\n {\n \"id\": 2\n }\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Persons
Update a Person
| ⚠️ This endpoint is currently in BETA |
|---|
Updates a Person. Only properties included in the request body are changed; any property
omitted from the request body is left alone. Likewise, only field-value entries listed in
fields are updated. Any field not included in fields keeps its current value.
POST
/
v2
/
persons
/
{personId}
Update a Person
curl --request POST \
--url https://api.affinity.co/v2/persons/{personId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.doe@northpointvc.com",
"emailAddresses": [
"jane.doe@northpointvc.com",
"janedoe@gmail.com"
],
"fields": [
{
"id": "affinity-data-location",
"value": {
"type": "company-multi",
"data": [
{
"id": 1
},
{
"id": 2
}
]
}
}
]
}
'import requests
url = "https://api.affinity.co/v2/persons/{personId}"
payload = {
"firstName": "Jane",
"lastName": "Doe",
"primaryEmailAddress": "jane.doe@northpointvc.com",
"emailAddresses": ["jane.doe@northpointvc.com", "janedoe@gmail.com"],
"fields": [
{
"id": "affinity-data-location",
"value": {
"type": "company-multi",
"data": [{ "id": 1 }, { "id": 2 }]
}
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: 'Jane',
lastName: 'Doe',
primaryEmailAddress: 'jane.doe@northpointvc.com',
emailAddresses: ['jane.doe@northpointvc.com', 'janedoe@gmail.com'],
fields: [
{
id: 'affinity-data-location',
value: {type: 'company-multi', data: [{id: 1}, {id: 2}]}
}
]
})
};
fetch('https://api.affinity.co/v2/persons/{personId}', 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.affinity.co/v2/persons/{personId}",
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([
'firstName' => 'Jane',
'lastName' => 'Doe',
'primaryEmailAddress' => 'jane.doe@northpointvc.com',
'emailAddresses' => [
'jane.doe@northpointvc.com',
'janedoe@gmail.com'
],
'fields' => [
[
'id' => 'affinity-data-location',
'value' => [
'type' => 'company-multi',
'data' => [
[
'id' => 1
],
[
'id' => 2
]
]
]
]
]
]),
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.affinity.co/v2/persons/{personId}"
payload := strings.NewReader("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"primaryEmailAddress\": \"jane.doe@northpointvc.com\",\n \"emailAddresses\": [\n \"jane.doe@northpointvc.com\",\n \"janedoe@gmail.com\"\n ],\n \"fields\": [\n {\n \"id\": \"affinity-data-location\",\n \"value\": {\n \"type\": \"company-multi\",\n \"data\": [\n {\n \"id\": 1\n },\n {\n \"id\": 2\n }\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.affinity.co/v2/persons/{personId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"primaryEmailAddress\": \"jane.doe@northpointvc.com\",\n \"emailAddresses\": [\n \"jane.doe@northpointvc.com\",\n \"janedoe@gmail.com\"\n ],\n \"fields\": [\n {\n \"id\": \"affinity-data-location\",\n \"value\": {\n \"type\": \"company-multi\",\n \"data\": [\n {\n \"id\": 1\n },\n {\n \"id\": 2\n }\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/persons/{personId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"primaryEmailAddress\": \"jane.doe@northpointvc.com\",\n \"emailAddresses\": [\n \"jane.doe@northpointvc.com\",\n \"janedoe@gmail.com\"\n ],\n \"fields\": [\n {\n \"id\": \"affinity-data-location\",\n \"value\": {\n \"type\": \"company-multi\",\n \"data\": [\n {\n \"id\": 1\n },\n {\n \"id\": 2\n }\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
Body
application/json
Partial-update request body for a Person. Only provided properties are updated; omitted properties keep their current value.
Response
No Content
Was this page helpful?