Pipedrive - Updating a Lead Returns 404 not found

180 views Asked by At

I am trying to update a LEAD using this URL

$lead_url = ‘https://’.$company_domain.’.pipedrive.com/api/v1/leads/’ . $leadID . ‘?api_token=’ . $PD_API_KEY;

But it returns 404 Not Found. When I check this URL in the browser it returns the complete information of that lead.

Here is my Curl Code:

function pipedrive_update_curl($arr , $endpoint)
{
$response = array();
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr));

//***//
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//**//

$response_result = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
curl_close($ch);
$response['error'] = $curl_errors;
$response['status'] = $status_code;
$response['response'] = $response_result;
return $response;
}

Can somebody please explain where I am going wrong?

1

There are 1 answers

0
Jhon Carlo Condy On