Hi
Trying to use Guzzle with PHP to batch update Deals.
Payload example:
[{"id":12345678,"properties":{"dealname":"001122334455-1, Bob Smith, 0099887766"}},{"id":4657890,"properties":{"dealname":"00334455667-1, John Jones, 00665544332"}}]
PHP code we’re using:
// API endpoint
$apiEndpoint = "https://api.hubapi.com/crm/v3/objects/deals/batch/update";
// Create a Guzzle client
$client = new Client();
// HubSpot API key and deal and contact IDs
$apiKey = 'XXXX';
$data = $deal_properties;
// Make a POST request to associate the deal with the contact
$response = $client->post($apiEndpoint, [
'headers' => [
'Authorization' => "Bearer {$apiKey}",
'Content-Type' => 'application/json',
],
'json' => $data
]);
Error received:
{"status":"error","message":"Invalid input JSON on line 1, column 1: Cannot construct instance of com.hubspot.apiutils.core.models.batch.BatchInput$Json (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('[{\"id\":12345678,\"properties\":{\"dealname\":\"001122334455-1, Bob Smith, 0099887766\"}},{\"id\":4657890,\"properties\":{\"dealname\":\"00334455667-1, John Jones, 00665544332\"}}
Any clues? Am I missing something simple?
Thanks