curl --request PATCH \
--url https://api.pruff.com/api/clients/contacts/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "María Pérez González",
"role": "Gerente general"
}
'import requests
url = "https://api.pruff.com/api/clients/contacts/{id}"
payload = {
"name": "María Pérez González",
"role": "Gerente general"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'María Pérez González', role: 'Gerente general'})
};
fetch('https://api.pruff.com/api/clients/contacts/{id}', 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.pruff.com/api/clients/contacts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'María Pérez González',
'role' => 'Gerente general'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-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://api.pruff.com/api/clients/contacts/{id}"
payload := strings.NewReader("{\n \"name\": \"María Pérez González\",\n \"role\": \"Gerente general\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.patch("https://api.pruff.com/api/clients/contacts/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"María Pérez González\",\n \"role\": \"Gerente general\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pruff.com/api/clients/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"María Pérez González\",\n \"role\": \"Gerente general\"\n}"
response = http.request(request)
puts response.read_body{
"id": 101,
"businessIdentifier": "11111111-1",
"businessName": "Comercial Ejemplo SpA",
"name": "María Pérez González",
"email": "maria.perez@example.com",
"phone": "912345678",
"role": "Gerente general",
"customRole": null,
"identifier": "22222222-2",
"observation": "Contacto principal para cobranza.",
"country": "CL",
"profession": "Ingeniera comercial",
"maritalStatus": "Casada",
"isLegalRepresentative": true,
"isPartner": false,
"isGuarantor": false,
"invoicing": true,
"selected": true,
"isClient": true
}Editar contacto de una empresa
Modifica solo los campos que envías de un contacto existente. Los campos que no envías quedan como están. El id es el de un elemento de Listar contactos.
Debes enviar al menos un campo. No puedes cambiar la empresa del contacto: si envías businessIdentifier, la solicitud responde 400. Los campos que el endpoint no reconoce se ignoran, incluidos selected e invoicing, que no se pueden modificar por esta API. Si el body solo trae campos que se ignoran, la solicitud responde 400.
Las validaciones son las mismas de Crear contacto de una empresa. Si envías identifier, no puede existir otro contacto con el mismo identifier en la misma empresa; en ese caso la solicitud responde 409.
La respuesta es el contacto actualizado, con los mismos campos que un elemento de data en Listar contactos.
curl --request PATCH \
--url https://api.pruff.com/api/clients/contacts/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "María Pérez González",
"role": "Gerente general"
}
'import requests
url = "https://api.pruff.com/api/clients/contacts/{id}"
payload = {
"name": "María Pérez González",
"role": "Gerente general"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'María Pérez González', role: 'Gerente general'})
};
fetch('https://api.pruff.com/api/clients/contacts/{id}', 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.pruff.com/api/clients/contacts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'María Pérez González',
'role' => 'Gerente general'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-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://api.pruff.com/api/clients/contacts/{id}"
payload := strings.NewReader("{\n \"name\": \"María Pérez González\",\n \"role\": \"Gerente general\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.patch("https://api.pruff.com/api/clients/contacts/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"María Pérez González\",\n \"role\": \"Gerente general\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pruff.com/api/clients/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"María Pérez González\",\n \"role\": \"Gerente general\"\n}"
response = http.request(request)
puts response.read_body{
"id": 101,
"businessIdentifier": "11111111-1",
"businessName": "Comercial Ejemplo SpA",
"name": "María Pérez González",
"email": "maria.perez@example.com",
"phone": "912345678",
"role": "Gerente general",
"customRole": null,
"identifier": "22222222-2",
"observation": "Contacto principal para cobranza.",
"country": "CL",
"profession": "Ingeniera comercial",
"maritalStatus": "Casada",
"isLegalRepresentative": true,
"isPartner": false,
"isGuarantor": false,
"invoicing": true,
"selected": true,
"isClient": true
}Parámetros de ruta
Cuerpo
Campos del contacto que quieres modificar. Envía solo los que cambian. No incluye businessIdentifier, que no se puede editar.
Respuesta
Contacto actualizado.
true si la empresa del contacto es cliente tuyo, es decir, si tu empresa tiene con ella una relación de enrolamiento vigente: activada y no desactivada a la fecha de la consulta. Es la misma regla de isEnrolled en Listar empresas. false en los demás casos, como prospectos y deudores sin enrolar. Puede diferir de la marca de cliente de la tabla Red > Contactos en Pruff, que considera cliente a toda empresa con una relación de enrolamiento registrada, en cualquier estado.
true