enzo
enzo

Reputation: 459

vTiger API Rest - create new lead

I downloaded the vTiger classes from here: https://blog.crm-now.de/2018/02/26/new-api-description-and-new-example-code-for-crm-rest-operations/?lang=en

But when I try to create a new lead it gives me this in response: "create failed: lastname does not have a value"

Below is my code:

$params= array(
        'email' => '[email protected]',
        'firstname' => 'my_name',
        'lastname ' => 'my_surname',
        'assigned_user_id' => 'my_user_id'
    );

$url = "url_my_site.com/webservice.php";

    $wsC = new WS_Curl_Class($url, 'my_username', 'secret_key');
    if (!$wsC->login()) {
        echo "error";
    }

    $result = $wsC->operation("create", array("elementType" => "Leads", "element" => json_encode($params)), "POST");
    if ($wsC->errorMsg) {
        // ERROR handling if describe operation was not successful
        echo $wsC->errorMsg;
    }

I don't understand why that error returns to me. Can someone help me? Thank you

Upvotes: 0

Views: 689

Answers (1)

Marco Caggiano
Marco Caggiano

Reputation: 317

Probably because there is a space at the end of 'lastname'

Upvotes: 0

Related Questions