Hi,
My Hubspot Database is feeded with external Contacts and Deals.
What is left are the correct Associations between Contacts and Deals.
for that I have createt a script with the following logic:
1. checks if there is already an exicting Association between Contact x and Deal y
2. if no create Association between x and y
I use curl and write in php
it is easy to find the code in the Documentation in Endpoints:
But when executing, Hubspot returns with an internal Error:
array(3) {
["status"]=>
string(5) "error"
["message"]=>
string(14) "internal error"
["correlationId"]=>
string(36) "c65b12f0-05b6-492a-980b-3c4ece2f8d9d"
}
This is the Code im Using:
$assocArray has correct Information about 1 existing Contact and 1 existing Deal
The Access App Token is changed to xxx
var_dump(searchAssociation($assocArray['id_hubspot'], $assocArray['id_hubspot_deal']));
if (!searchAssociation($assocArray['id_hubspot'], $assocArray['id_hubspot_deal']))
{
createAssociation($assocArray['id_hubspot'], $assocArray['id_hubspot_deal']);
}
function createAssociation($fromID, $toID)
{
$url ='https://api.hubapi.com/crm/v4/objects/contacts/'.$fromID. '/associations/deals/'.$toID;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('authorization: Bearer xxx'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$resultarray = json_decode($result, true);
var_dump($resultarray);
}
Maybe somebody can help me wtih this Error?
What does this Error stand for?
Thank you^^