I’m using the Hubspot API to create a Custom Object in Hubspot. This is working as intended. But I’d like to associate a Contact to the Custom Object. I see documentation on how to do this with the API as a seperate step- but I wasn’t sure if I could create the Custom Object AND create the association with one API call?
Right now I pass a JSON object with the properties key to the
https://api.hubapi.com/crm/v3/objects/:objectType endpoint via a POST.
I was wondering if I could add on an “associations” key to that JSON object to have the association be created at the same time as the custom object?
In my mind it would look something like this:
const JSONtoPOST = {
'properties': {
'name': 'example'
},
'associations': {
'contacts': {
'results': [
{
'id': '12345678',
'type': 'contact_to_custom_object',
},
],
},
}
}