We have been using the Pipedrive API products and deals endpoints for some months now for both updating and creating new records. On March 29th, our integrations broke without warning.
It appears that it is now not possible to update a single option custom field using string of the value, instead the associated key id for that option must be provided. As an example:
Previous Code :
$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(“Content-Type”, “application/json”)
$body = “{"59fb458ceb385436f1988826cf0535608980eec6
”:"Sent
"}"
$concat = “https://api.pipedrive.com/v1/products/” + $id + “?api_token=[[token]]”
try {
$PutResponse = Invoke-RestMethod $concat -Method ‘PUT’ -Headers $headers -Body $body …
This code ran for months without issue (200 OK response) but suddenly returns
Invoke-RestMethod : The remote server returned an error: (422) Unprocessable Entity.| At line:9 char:16| + ... tResponse = Invoke-RestMethod $concatta -Method 'PUT' -Headers $heade ...| + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException| + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand|
The same occurs on Postman, and there is record in history of the previous method being successful.
Postman error :
{
“success”: false,
“error”: “Expected ‘number’ as value for single option custom field”,
“error_info”: “Please check developers.pipedrive.com for more information about Pipedrive API.”,
“data”: null,
“additional_data”: null
}
New working code:
$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(“Content-Type”, “application/json”)
$body = “{"59fb458ceb385436f1988826cf0535608980eec6
”:"981
"}"
$concatta = “https://api.pipedrive.com/v1/products/” + $id + “?api_token=[[token]]”
try {
$PutResponse = Invoke-RestMethod $concat -Method ‘PUT’ -Headers $headers -Body $body …
where “981” is the id representing the “Sent” value.
From what I can see, this appears to be an undocumented change in how the Pipedrive API functions.
Is there documentation for this change? Is this change intended?
Please advise