Here is an example for creating a lead using the 'set_entry' method. This works with my 6.2 installation. I removed some lines (I had several more 'name_value_list' entries) to make it shorter. I hope this helps you:
PHP Code:
// create a new leads record and grab the leads ID
$param_entry_list=array(
'session'=>$session_id,
'module_name'=>'Leads',
'name_value_list'=> array(
array("name" => 'account_name',"value" => urlencode($account_name)),
array("name" => 'primary_address_street',"value" => urlencode($primary_address_street)),
array("name" => 'primary_address_postalcode',"value" => urlencode($primary_address_postalcode)),
array("name" => 'primary_address_city',"value" => urlencode($primary_address_city)),
array("name" => 'email1',"value" => urlencode($email1)),
array("name" => 'description',"value" => urlencode($description))
)
);
$json = json_encode($param_entry_list);
$postArgs = 'method=set_entry&input_type=JSON&response_type=JSON&rest_data=' . $json;
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
$response = curl_exec($curl);
$result = json_decode($response);
if (!$result->id) {
DEBUG("Fatal Error", "Lead Generation Failed");
die();
}
$lead_id = $result->id;
Bookmarks