Function to create a new person
https://rest.crmango.com/api/CreateNewPerson
Bearer
varchar
Auth token
firstname
varchar
Firstname
lastname
varchar
Lastname
title_before_name
varchar
Title before name
title_after_name
varchar
Title after name
work_position
varchar
Work position
phone_1
integer
Phone 1
phone_2
integer
Phone 2
email
varchar
birth_number
varchar
Birth number
allow_send_email
boolean
True or False: You need the client consent to send them marketing emails.
own_cols[data]
varchar
Input data
Function to create a new person
code
integer
Return code
message
varchar
Info message
created_id
integer
Id of the created resource
curl --request POST \
--url 'https://rest.crmango.com/api/CreateNewPerson' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"owner": 7,
"firstname": "Anton",
"lastname": "Mrkvicka",
"title_before_name": "Ing",
"title_after_name": "",
"work_position": "CEO",
"phone1_prefix": "SK +421",
"phone_1": "911123456",
"phone2_prefix": "CZ +420",
"phone_2": "703456789",
"email": "support@crmango.com",
"company_id": 3468,
"birth_number": "123456/3654",
"allow_send_email": true,
"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/CreateNewPerson',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"data": {
"owner": 7,
"firstname": "Anton",
"lastname": "Mrkvicka",
"title_before_name": "Ing",
"title_after_name": "",
"work_position": "CEO",
"phone1_prefix": "SK +421",
"phone_1": "911123456",
"phone2_prefix": "CZ +420",
"phone_2": "703456789",
"email": "support@crmango.com",
"company_id": 3468,
"birth_number": "123456/3654",
"allow_send_email": true,
"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({
"data": {
"owner": 7,
"firstname": "Anton",
"lastname": "Mrkvicka",
"title_before_name": "Ing",
"title_after_name": "",
"work_position": "CEO",
"phone1_prefix": "SK +421",
"phone_1": "911123456",
"phone2_prefix": "CZ +420",
"phone_2": "703456789",
"email": "support@crmango.com",
"company_id": 3468,
"birth_number": "123456/3654",
"allow_send_email": true,
"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("POST", "https://rest.crmango.com/api/CreateNewPerson");
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/CreateNewPerson"
payload = json.dumps({
"data": {
"owner": 7,
"firstname": "Anton",
"lastname": "Mrkvicka",
"title_before_name": "Ing",
"title_after_name": "",
"work_position": "CEO",
"phone1_prefix": "SK +421",
"phone_1": "911123456",
"phone2_prefix": "CZ +420",
"phone_2": "703456789",
"email": "support@crmango.com",
"company_id": 3468,
"birth_number": "123456/3654",
"allow_send_email": true,
"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("POST", url, headers=headers, data=payload)
print(response.text)
{
"code": 201,
"message": "New person has been added",
"created_id": 2654
}
{
"code": "int",
"message": "string"
}