Description
We are attempting to update custom objects following the documentation for updated by external id (https://developer.zendesk.com/api-reference/custom-data/custom-objects/custom_object_records/#set-custom-object-record-by-external-id-or-name)
However, the only way to send a PATCH method is to do something like this:
$client->post($url, $data, ['method' => 'PATCH']);
But when I try that, I'm getting this error:
An error occurred calling API. Error: Client error: `POST https://bubblebinzfranchisellc.zendesk.com/api/v2/custom_objects/service_request/records?external_id=20693` resulted in a `422 Unprocessable Entity` response:
{"error":"RecordInvalid","description":"Record validation errors","details":{"external_id":[{"description":"This externa (truncated...)
[details] {"error":"RecordInvalid","description":"Record validation errors","details":{"external_id":[{"description":"This external ID is already in use."}]}}
So I looked into the HttpClient class and check the post method there. You have the array_merge backwards I think. The $options being sent in containing 'method' => 'PATCH' is getting overridden by the POST method in the second array.
$extraOptions = array_merge($options, [
'postFields' => $postData,
'method' => 'POST'
]);
In my local system, I modified the class and reversed it as such:
$extraOptions = array_merge([
'postFields' => $postData,
'method' => 'POST'
], $options);
And it works perfectly fine. But I don't have a way to do that on the server because this is controlled by composer.
Can you please make this adjustment ASAP?