0

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' => 'myemail@libe.test',
        '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

enzo
  • 419
  • 3
  • 7
  • 16

1 Answers1

0

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

Marco Caggiano
  • 308
  • 2
  • 8