Reputation: 141
I have a list of custom fields for a Deals in Pipedrive. (Located here https://your-instance.pipedrive.com/settings/fields?type=DEAL)
Each custom field has a custom API Key
which looks like this a56aff894af47285d3bbcd67fe06ee5143fb1123
I try to update these fields in a Deal in bulk.
According to the Update a deal
documentation https://developers.pipedrive.com/docs/api/v1/#!/Deals/put_deals_id there is no information about these custom fields.
The question is how to update custom field value in a certain Deal?
Upvotes: 1
Views: 1310
Reputation: 141
To achieve this you can send custom field key - value pairs just in the request body.
According to this example:
// Pipedrive API token
$api_token = '659c9fddb16335e48cc67114694b52074e812';
// Custom field key value pairs
$data = array(
'dcf558aac1ae4e8c4f849ba5e668430d8df9be12' => 'Custom field value'
);
// Deal ID
$deal_id = 260;
// URL for updating a Deal
$url = 'https://your-instance.pipedrive.com/api/v1/deals/' . $deal_id . '?api_token=' . $api_token;
// Prepare CURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
curl_close($ch);
Upvotes: 3