CRM
Choose the card's primary contact
Marks one of the contacts linked to the card as the primary one. The primary contact comes first in contacts, appears in primaryContactId and is the contact that the stages’ automatic activities use. Without a choice, the primary contact is the one linked the longest. Choosing the contact that is already the primary one changes nothing. The card and the contact must belong to the token’s company, and the contact must be linked to the card (POST /crm/cards/{cardId}/contacts); otherwise, 404.
PUT
/
crm
/
cards
/
{cardId}
/
primary-contact
Choose the card's primary contact
curl --request PUT \
--url https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactId": 1042
}
'import requests
url = "https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact"
payload = { "contactId": 1042 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contactId: 1042})
};
fetch('https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact', 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.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'contactId' => 1042
]),
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.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact"
payload := strings.NewReader("{\n \"contactId\": 1042\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactId\": 1042\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactId\": 1042\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "ERR_API_NOT_FOUND",
"message": "Registro não encontrado."
}
}{
"error": {
"code": "ERR_API_VALIDATION",
"message": "O parâmetro `application` é obrigatório e aceita \"contact\" ou \"card\"."
}
}⌘I
Choose the card's primary contact
curl --request PUT \
--url https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactId": 1042
}
'import requests
url = "https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact"
payload = { "contactId": 1042 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contactId: 1042})
};
fetch('https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact', 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.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'contactId' => 1042
]),
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.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact"
payload := strings.NewReader("{\n \"contactId\": 1042\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactId\": 1042\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.connectadesk.com/api/v1/crm/cards/{cardId}/primary-contact")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactId\": 1042\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "ERR_API_NOT_FOUND",
"message": "Registro não encontrado."
}
}{
"error": {
"code": "ERR_API_VALIDATION",
"message": "O parâmetro `application` é obrigatório e aceita \"contact\" ou \"card\"."
}
}
