Function creates a new lead. The assignee is notified by e-mail
https://rest.crmango.com/api/CreateNewLead
Bearer
varchar
Auth token
lead_name
varchar
Lead name (required)
lead_creator
integer
Lead creator. For a token bound to a user it is always that user
Reference: GetAllUsers
when_contact_date
date
Date when to contact the lead (YYYY-MM-DD)
contacted_date
date
Date when the lead was contacted (YYYY-MM-DD)
company_id
varchar
Company id (IČO)
company_name
varchar
Company name
company_country
varchar
Country ISO2 code
company_address
varchar
Company address
company_postal
varchar
Company postal
person_name
varchar
Person name
person_surname
varchar
Person surname
person_phone
varchar
Person phone number
person_email
varchar
Person e-mail
priority
integer
Priority
Options: 1, 2 or 3
lead_note
varchar
Note
product_id
integer
Id of active product/service
affiliate_code
varchar
Affiliate code
Function creates a new lead
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/CreateNewLead' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"lead_name": "CRMango s.r.o.",
"when_contact_date": "2022-12-23",
"contacted_date": "2023-03-12",
"lead_creator": 0,
"lead_assignee": 0,
"company_id": "",
"company_mango_id": 0,
"company_name": "Crmango s.r.o.",
"company_country_id": 56,
"company_country": "CZ",
"company_address": "Hlavna 70",
"company_postal": "32323",
"person_name": "",
"person_surname": "",
"person_phone": "",
"person_email": "",
"person_mango_id": 0,
"lead_status_id": 1,
"lead_source_id": 3,
"lead_campaign_id": 1,
"priority": 3,
"lead_note": "note",
"affiliate_code": "L59jahNtWjH6QuG4|!|!|!150Pv22|!|!|!Vs9Udd1F1jcSoIxrzQ=",
"product_id": 11
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/CreateNewLead',
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": {
"lead_name": "CRMango s.r.o.",
"when_contact_date": "2022-12-23",
"contacted_date": "2023-03-12",
"lead_creator": 0,
"lead_assignee": 0,
"company_id": "",
"company_mango_id": 0,
"company_name": "Crmango s.r.o.",
"company_country_id": 56,
"company_country": "CZ",
"company_address": "Hlavna 70",
"company_postal": "32323",
"person_name": "",
"person_surname": "",
"person_phone": "",
"person_email": "",
"person_mango_id": 0,
"lead_status_id": 1,
"lead_source_id": 3,
"lead_campaign_id": 1,
"priority": 3,
"lead_note": "note",
"affiliate_code": "L59jahNtWjH6QuG4|!|!|!150Pv22|!|!|!Vs9Udd1F1jcSoIxrzQ=",
"product_id": 11
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
"data": {
"lead_name": "CRMango s.r.o.",
"when_contact_date": "2022-12-23",
"contacted_date": "2023-03-12",
"lead_creator": 0,
"lead_assignee": 0,
"company_id": "",
"company_mango_id": 0,
"company_name": "Crmango s.r.o.",
"company_country_id": 56,
"company_country": "CZ",
"company_address": "Hlavna 70",
"company_postal": "32323",
"person_name": "",
"person_surname": "",
"person_phone": "",
"person_email": "",
"person_mango_id": 0,
"lead_status_id": 1,
"lead_source_id": 3,
"lead_campaign_id": 1,
"priority": 3,
"lead_note": "note",
"affiliate_code": "L59jahNtWjH6QuG4|!|!|!150Pv22|!|!|!Vs9Udd1F1jcSoIxrzQ=",
"product_id": 11
}
});
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/CreateNewLead");
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/CreateNewLead"
payload = json.dumps({
"data": {
"lead_name": "CRMango s.r.o.",
"when_contact_date": "2022-12-23",
"contacted_date": "2023-03-12",
"lead_creator": 0,
"lead_assignee": 0,
"company_id": "",
"company_mango_id": 0,
"company_name": "Crmango s.r.o.",
"company_country_id": 56,
"company_country": "CZ",
"company_address": "Hlavna 70",
"company_postal": "32323",
"person_name": "",
"person_surname": "",
"person_phone": "",
"person_email": "",
"person_mango_id": 0,
"lead_status_id": 1,
"lead_source_id": 3,
"lead_campaign_id": 1,
"priority": 3,
"lead_note": "note",
"affiliate_code": "L59jahNtWjH6QuG4|!|!|!150Pv22|!|!|!Vs9Udd1F1jcSoIxrzQ=",
"product_id": 11
}
})
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 lead has been created",
"created_id": 158
}
{
"code": "int",
"message": "string"
}