Zaktualizuj kontakt
curl --request PUT \
--url https://api.example.com/api/v1/contacts/{email} \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [
{}
],
"list_id": 123,
"list_name": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/contacts/{email}"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [{}],
"list_id": 123,
"list_name": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
phone: '<string>',
tags: [{}],
list_id: 123,
list_name: '<string>'
})
};
fetch('https://api.example.com/api/v1/contacts/{email}', 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.example.com/api/v1/contacts/{email}",
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([
'first_name' => '<string>',
'last_name' => '<string>',
'phone' => '<string>',
'tags' => [
[
]
],
'list_id' => 123,
'list_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/contacts/{email}"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.example.com/api/v1/contacts/{email}")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/contacts/{email}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 123,
"email": "john@example.com",
"first_name": "Jonathan",
"last_name": "Doe",
"phone": "+1987654321",
"tags": ["vip", "premium", "enterprise"],
"lead_score": 85,
"created_at": "2025-01-15T10:30:00",
"updated_at": "2025-12-30T10:00:00"
},
"message": "Kontakt zaktualizowany pomyślnie"
}
{
"success": false,
"error": {
"code": "CONTACT_NOT_FOUND",
"message": "Nie znaleziono kontaktu o adresie email: john@example.com"
}
}
Kontakty
Zaktualizuj kontakt
Zaktualizuj informacje o kontakcie po adresie email
PUT
/
api
/
v1
/
contacts
/
{email}
Zaktualizuj kontakt
curl --request PUT \
--url https://api.example.com/api/v1/contacts/{email} \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [
{}
],
"list_id": 123,
"list_name": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/contacts/{email}"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"tags": [{}],
"list_id": 123,
"list_name": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
phone: '<string>',
tags: [{}],
list_id: 123,
list_name: '<string>'
})
};
fetch('https://api.example.com/api/v1/contacts/{email}', 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.example.com/api/v1/contacts/{email}",
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([
'first_name' => '<string>',
'last_name' => '<string>',
'phone' => '<string>',
'tags' => [
[
]
],
'list_id' => 123,
'list_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/v1/contacts/{email}"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.example.com/api/v1/contacts/{email}")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/contacts/{email}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"phone\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"list_id\": 123,\n \"list_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 123,
"email": "john@example.com",
"first_name": "Jonathan",
"last_name": "Doe",
"phone": "+1987654321",
"tags": ["vip", "premium", "enterprise"],
"lead_score": 85,
"created_at": "2025-01-15T10:30:00",
"updated_at": "2025-12-30T10:00:00"
},
"message": "Kontakt zaktualizowany pomyślnie"
}
{
"success": false,
"error": {
"code": "CONTACT_NOT_FOUND",
"message": "Nie znaleziono kontaktu o adresie email: john@example.com"
}
}
Parametry ścieżki
string
required
Adres email kontaktu
Treść żądania
string
Imię kontaktu
string
Nazwisko kontaktu
string
Numer telefonu kontaktu
array
Tablica nazw tagów (zastępuje istniejące tagi)
integer
ID listy mailingowej do której dodać kontakt
string
Nazwa listy mailingowej do której dodać kontakt (alternatywa dla list_id)
Odpowiedź
boolean
Wskazuje czy żądanie zakończyło się sukcesem
object
Zaktualizowany obiekt kontaktu ze wszystkimi polami
string
Komunikat sukcesu
Przykład
curl -X PUT https://api.mailist.com/api/v1/contacts/john@example.com \
-H "X-API-Key: TWOJ_KLUCZ_API" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jonathan",
"phone": "+1987654321",
"tags": ["vip", "premium", "enterprise"]
}'
const response = await fetch('https://api.mailist.com/api/v1/contacts/john@example.com', {
method: 'PUT',
headers: {
'X-API-Key': 'TWOJ_KLUCZ_API',
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: 'Jonathan',
phone: '+1987654321',
tags: ['vip', 'premium', 'enterprise']
})
});
const data = await response.json();
import requests
response = requests.put(
'https://api.mailist.com/api/v1/contacts/john@example.com',
headers={
'X-API-Key': 'TWOJ_KLUCZ_API',
'Content-Type': 'application/json'
},
json={
'first_name': 'Jonathan',
'phone': '+1987654321',
'tags': ['vip', 'premium', 'enterprise']
}
)
data = response.json()
Odpowiedź
{
"success": true,
"data": {
"id": 123,
"email": "john@example.com",
"first_name": "Jonathan",
"last_name": "Doe",
"phone": "+1987654321",
"tags": ["vip", "premium", "enterprise"],
"lead_score": 85,
"created_at": "2025-01-15T10:30:00",
"updated_at": "2025-12-30T10:00:00"
},
"message": "Kontakt zaktualizowany pomyślnie"
}
{
"success": false,
"error": {
"code": "CONTACT_NOT_FOUND",
"message": "Nie znaleziono kontaktu o adresie email: john@example.com"
}
}
