Association broken on v9+
accexs opened this issue · comments
Had to rollback an update since i was unable to make it work, even tried directly with URL thrown in the response error and had no success, on version 8.4.1 works fine.
$hubspot->crm()->companies()->associationsApi()->create( '15385147981', 'contact', '201', '2' );
Error:
[2023-04-29 00:54:47] local.ERROR: HubSpot\Client\Crm\Companies\ApiException: [400] Client error: `PUT https://api.hubapi.com/crm/v4/objects/companies/15385147981/associations/contact/201` resulted in a `400 Bad Request` response:
{"status":"error","message":"Invalid input JSON on line 1, column 1: Cannot deserialize value of type `java.util.HashSet (truncated...)
url tested directly on postman:
https://api.hubapi.com/crm/v4/objects/companies/15385147981/associations/contact/201
results in:
{
"status": "error",
"message": "internal error",
"correlationId": "f5ec099d-9b77-41d5-ae3e-601b964aef1d"
}
Maybe i'm missing something.
Hi @accexs .
We have changed the latest param from association_type
to AssociationSpec[]
.
Workable example:
use HubSpot\Factory;
use HubSpot\Client\Crm\Companies\Model\AssociationSpec;
$hubspot = Factory::createWithAccessToken('*');
$spec = new AssociationSpec([
'association_category' => 'HUBSPOT_DEFINED',
'association_type_id' => '2'
]);
$hubspot->crm()->companies()->associationsApi()->create( '8644539994', 'contact', '323751', [$spec]);
The SDK version is 9.4.0 .
Feel free to reopen if any questions.