Function to update contact. Only the sent fields are changed, the rest stays. Custom columns (own_cols) can be sent partially. Active items (aktivnep_id) are changed only when sent.
https://rest.crmango.com/api/UpdateContact
Bearer
varchar
Auth token
is_company
boolean
0 - self-employed, 1 - company
title
varchar
Company name
company_id_number
integer
Company id number (numbers only)
vat_number
varchar
Company vat number
vat
varchar
Company vat
firstname
varchar
Firstname
lastname
varchar
Lastname
birth_number
varchar
Birth number
address
varchar
Address
city
varchar
City
postcode
integer
Postcode
district
varchar
District
region
varchar
Region
latitude
float
Latitude
longitude
float
Longitude
disabled
boolean
0 - active, 1 - disabled
next_activity
timestamp
Date of next activity
score
integer
Score 0 - 5
invoice_days
integer
Invoice due days
invoice_type
integer
Invoice type
invoice_note
varchar
Invoice note
credit_limit
float
Credit limit
company_currency
varchar
Currency id or code (e.g. EUR). Unknown code = 202
invoice_email
varchar
E-mail for invoices
mailing_name
varchar
Mailing address - name
mailing_address
varchar
Mailing address - street
mailing_city
varchar
Mailing address - city
mailing_postal
integer
Mailing address - postcode
internal_note
varchar
Internal note (stored encrypted)
general_discount
float
General discount in percent
own_cols[data]
varchar
Input data
Function to update contact
code
integer
Return code
message
varchar
Info message
curl --request PUT \
--url 'https://rest.crmango.com/api/UpdateContact' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
{
"contact_id": 3482,
"data": {
"owner": 7,
"is_company": 1,
"title": "CRMango",
"company_id_number": "123456",
"vat_number": "SK123456",
"vat": "123456",
"firstname": "Anton",
"lastname": "Mrkvicka",
"birth_number": "",
"address": "Dopravna",
"city": "Bratislava",
"postcode": "92101",
"district": "Bratislava",
"region": "Bratislavsky",
"state": "202",
"latitude": "",
"longitude": "",
"disabled": 0,
"user": 57,
"next_activity": 0,
"status_id": 0,
"typk_id": 0,
"aktivnep_id": ",1,2,",
"own_cols": [
{
"id_own_col": 1,
"data": "This is text"
},
{
"id_own_col": 2,
"data": "2022-09-23"
},
{
"id_own_col": 3,
"data": "Apple"
},
{
"id_own_col": 5,
"data": "This is text"
},
{
"id_own_col": 7,
"data": 1
}
]
}
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/UpdateContact',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
{
"contact_id": 3482,
"data": {
"owner": 7,
"is_company": 1,
"title": "CRMango",
"company_id_number": "123456",
"vat_number": "SK123456",
"vat": "123456",
"firstname": "Anton",
"lastname": "Mrkvicka",
"birth_number": "",
"address": "Dopravna",
"city": "Bratislava",
"postcode": "92101",
"district": "Bratislava",
"region": "Bratislavsky",
"state": "202",
"latitude": "",
"longitude": "",
"disabled": 0,
"user": 57,
"next_activity": 0,
"status_id": 0,
"typk_id": 0,
"aktivnep_id": ",1,2,",
"own_cols": [
{
"id_own_col": 1,
"data": "This is text"
},
{
"id_own_col": 2,
"data": "2022-09-23"
},
{
"id_own_col": 3,
"data": "Apple"
},
{
"id_own_col": 5,
"data": "This is text"
},
{
"id_own_col": 7,
"data": 1
}
]
}
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
{
"contact_id": 3482,
"data": {
"owner": 7,
"is_company": 1,
"title": "CRMango",
"company_id_number": "123456",
"vat_number": "SK123456",
"vat": "123456",
"firstname": "Anton",
"lastname": "Mrkvicka",
"birth_number": "",
"address": "Dopravna",
"city": "Bratislava",
"postcode": "92101",
"district": "Bratislava",
"region": "Bratislavsky",
"state": "202",
"latitude": "",
"longitude": "",
"disabled": 0,
"user": 57,
"next_activity": 0,
"status_id": 0,
"typk_id": 0,
"aktivnep_id": ",1,2,",
"own_cols": [
{
"id_own_col": 1,
"data": "This is text"
},
{
"id_own_col": 2,
"data": "2022-09-23"
},
{
"id_own_col": 3,
"data": "Apple"
},
{
"id_own_col": 5,
"data": "This is text"
},
{
"id_own_col": 7,
"data": 1
}
]
}
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PUT", "https://rest.crmango.com/api/UpdateContact");
xhr.setRequestHeader("Authorization", "Bearer auth_token");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
import requests
import json
url = "https://rest.crmango.com/api/UpdateContact"
payload = json.dumps({
{
"contact_id": 3482,
"data": {
"owner": 7,
"is_company": 1,
"title": "CRMango",
"company_id_number": "123456",
"vat_number": "SK123456",
"vat": "123456",
"firstname": "Anton",
"lastname": "Mrkvicka",
"birth_number": "",
"address": "Dopravna",
"city": "Bratislava",
"postcode": "92101",
"district": "Bratislava",
"region": "Bratislavsky",
"state": "202",
"latitude": "",
"longitude": "",
"disabled": 0,
"user": 57,
"next_activity": 0,
"status_id": 0,
"typk_id": 0,
"aktivnep_id": ",1,2,",
"own_cols": [
{
"id_own_col": 1,
"data": "This is text"
},
{
"id_own_col": 2,
"data": "2022-09-23"
},
{
"id_own_col": 3,
"data": "Apple"
},
{
"id_own_col": 5,
"data": "This is text"
},
{
"id_own_col": 7,
"data": 1
}
]
}
}
})
headers = {
'Authorization': 'Bearer auth_token',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
{
"code": 200,
"message": "Contact has been updated"
}
{
"code": "int",
"message": "string"
}