webservice.php Vtiger update Query String php curl post
<p>Does any one know how to properly format the update query in vtiger to update a record under the Leads module?</p>

<p>I have been following this: <a href="http://community.vtiger.com/help/vtigercrm/developers/third-party-app-integration.html" rel="nofollow">http://community.vtiger.com/help/vtigercrm/developers/third-party-app-integration.html</a> </p>

<p>and have been able to login, query, and do the challenge response, but I have been unable to get the update function to work and it could be because I am not sure how they want the query to look.  This is the error I get when I send the query:  </p>

<pre><code>stdClass Object ( [success] =&gt; [error] =&gt; stdClass Object ( [code] =&gt; ACCESS_DENIED [message] =&gt; Permission to perform the operation is denied for id ) )   
</code></pre>

<p>Current Test Code:</p>

<pre><code>function updatesomeone(){
global $createduserleadnum;
global $url;
global $sessionID;
global $createduserid;


$customdata = array(
'firstname'=&gt; 'TestAPILead2',//Update First name
'lastname'=&gt; 'TestAPILeadLast2', //Updated Last name
'leadstatus'=&gt; 'New',
'leadsource'=&gt; 'Some Lead Source', //Not Real Lead source
'assigned_user_id'=&gt; 'User-Assigned', //not real user
'cf_755'=&gt; 'A Custom Field', // A Custom Field
'lead_no' =&gt; $createduserleadnum, Acquired from other function/stored value
);

$customdata = json_encode($customdata);
$field = array(
'operation' =&gt; 'update',
'sessionName'=&gt; $sessionID,
'element' =&gt; $customdata
);


$fields_string;
foreach($field as $key=&gt;$value) { global $fields_string;
$fields_string .= $key.'='.$value.'&amp;'; }
$ch = curl_init();


curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($field));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

$result = curl_exec($ch);
$pringjson = json_decode($result);

print_r($pringjson);
</code></pre>

<p>}</p>