Contact associations on custom object not saving

SOLVE
Augustus
Contributor

I'm executing a script that takes a list of custom object-to-contact id pairs where each pair of ids needs to be associated to each other.

 

For each id pair, I'm using the association end point on the object to create the association.

 

Ex. https://api.hubapi.com/crm/v3/objects/{custom_obj_type}/{custom_obj_id}/associations/contacts/{contact_id}/custom_object_to_contact

 

For each pair, I receive back a 200 response indicating that the association has been made successfully, however, in cases where a contact id appears more than once in the list, it is only actually saving one occurrence of the contact id to its respective custom object - all other occurrences of this contact id associating to other custom objects will not save - THIS IS DESPITE RECEIVING BACK A 200 ON THESE OTHER OCCURRENCES.

 

Does this have something to do with API calls being made too frequently on a single contact ID?  I have a 1 second delay between each API call - should this be extended?

0 Upvotes
1 Accepted solution

Accepted Solutions
Augustus
Solution
Contributor

I recreated the assoction with ONE_TO_MANY as cardinality and inverseCardinality and that corrected the issue.  

View solution in original post

4 Replies 4
Augustus
Contributor

I have identified the issue that the association cardinality/inverseCardinality between these two objects is ONE_TO_MANY/ONE_TO_ONE and in fact needs to be ONE_TO_MANY in both directions.


Since I already have this association in place with objects associated, is there a way to update the association cardinality types directly?

 

Ideally, there is a method to update without needing to remove the objects already associated, re-create the association, and then re-associate all of the objects.

0 Upvotes
Augustus
Solution
Contributor

I recreated the assoction with ONE_TO_MANY as cardinality and inverseCardinality and that corrected the issue.  

View solution in original post

sharonlicari
Community Manager

thank you for sharing! 🙂


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes
Augustus
Contributor

The 200 success responses on the updates is what threw me off because it appeared that all of the associations were saving correctly but it wasn't clear that on each 200 success being returned, the back-end was implicitly removing the association for that contact from the other object it was already associated with.  It would be a nice feature if the response could provide some indication that an association was removed while making the new association due to the cardinality restriction.

0 Upvotes