POST /CreateNewLead

  • HTTP Status 201

    Function to create a new lead

    • code Type: integer

      Return code


    • message Type: varchar

      Info message


    • created_id Type: integer

      Id of the created resource


    Query Response Example

    {
        "code": 201,
        "message": "New lead has been created",
        "created_id": 158
    }

    Error Response Example

    {
        "code": "int",
        "message": "string"
    }
  • Parameters

    Parameters that need to be sent in the request

      Authorization

    • Bearer Type: varchar

      Auth token


    • Body data

    • lead_name Type: varchar

      Lead name


    • when_contact_date Type: date

      Date when contact lead


    • contacted_date Type: date

      Date when lead was contacted


    • lead_creator Type: integer

      Lead creator
      Reference: GetAllUsers


    • lead_assignee Type: integer

      Lead assignee
      Reference: GetAllUsers


    • company_id Type: integer

      Internal company id


    • company_name Type: varchar

      Company name


    • company_country_id Type: integer

      Country id
      Reference: GetAllStates


    • company_country Type: varchar

      Country name


    • company_address Type: varchar

      Company address


    • company_postal Type: integer

      Company postal


    • person_name Type: varchar

      Company person name


    • person_surname Type: varchar

      Company person surname


    • person_phone Type: varchar

      Company person phone number


    • person_email Type: varchar

      Company person e-mail address


    • person_mango_id Type: integer

      Company person id
      Reference: GetAllPersons


    • lead_status_id Type: integer

      Lead status id
      Reference: GetAllLists


    • lead_source_id Type: integer

      Lead source id
      Reference: GetAllLists


    • lead_campaign_id Type: integer

      Lead campaign id
      Reference: GetAllLists


    • priority Type: integer

      Lead priority
      Options: 1,2 or 3


    • lead_note Type: varchar

      Note


    • affiliate_code Type: varchar

      Affiliate code


    • product_id Type: integer

      Id of active product/service


Example Request

Mac window icon
$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);

curl_close($curl);

echo $response;
chat