In v3 of the CRM Associations API, you could delete a single type of association between two objects like so:
DELETE /crm/v3/objects/#{object_name}/#{object_id}/associations/#{reference_object_name}/#{reference_object_id}/#{association_type}
Or more concretely, deleting the association between a Company to a Contact:
DELETE “/crm/v3/objects/companies/123/associations/contacts}/123/COMPANY_TO_CONTACT”
But that same ability doesn’t appear to exist in v4? You can only delete all association types between two objects?
DELETE…/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}
So if I had a Company with two association defintions both to Customers: One Hubspot_defined (Company To Contact, unlabeled) and one User_defined (Company To Contact, labeled: VIP). I don’t have a way of just deleting just the VIP association?
Hi, @rare-gecko thank you very much for the great question.
Hey, @LMeert do you have any insight you can share for @rare-gecko and their question?
Thank you very much! – Jaycee
Hi @rare-gecko,
After some testing, it looks like you are right that you can’t target a specific association with the v4 endpoint, you either delete all or not (all but the association labelled primary)
On the other hand, the v3 is still very much usable :
- first run a v4 call to get associations between two records to get the list of association with labels and associationTypeID (cf. below for contact object with ID 37601)
- Then run your v3 call to delete the association and specify the TypeID you want to delete in lieu of the {associationType} parameter.
If I take the example above, I’ll make a DELETE call to this endpoint :
crm/v3/objects/contact/37601/associations/company/7725139306**/57**
I agree that this is weird to find out that the v4 of the associations API adds the label feature but in the process becomes less flexible than the v3.
Maybe that’s something @Jaycee_Lewis can report to the product team ?
Unless of course I’m wrong and someone figured out how to do it ? @Teun or @Anonymous maybe ?
Best,
Ludwig