Hi there,
Hope someone can help me with the followin issue:
I created a custom object via the api (at a time when it wasn’t possible in the system itself) and added the needed associatio in an array:
“associatedObjects”: [
“CONTACT”,
“COMPANY”,
“TICKET”,
“DEAL”,
“2-3453932”
]
I am now trying to put together a collection for the external devloper to send me contacts with the associated custom object according to the contact API documentation:
CRM API | Contacts (hubspot.com)
Associate a contact with another object
PUT…/crm/v4/objects/contacts/{contactId}/associations/{toObjectType}/{toObjectId}
Unfortunatley I am struggling with the paramaters I have to fill, especially with the association type.
After trying with different values I decided to reach out to Hubspot support and there I was told that there was no association between the contact and the custom object and that I would have to create an association via PUT to /crm/v3/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}/{associationType}.
And then was linked to this:
"If the object relationship is already defined, to determine the associationType value, make a GET request to crm/v3/schemas/{objectType}. "
I did this request to get the schema
https://api.hubapi.com/crm/v3/schemas/2-7111007
and got the response:
{
"fromObjectTypeId": "2-7111007",
"toObjectTypeId": "0-1",
"name": "event\_to\_contact",
"cardinality": "ONE\_TO\_MANY",
"inverseCardinality": "ONE\_TO\_MANY",
"id": "47",
"createdAt": null,
"updatedAt": null
},
This makes be believe that the association is already there.
I used the values to assign the contacts to the custom object again (the name of my custom object is event):
contact: 15601
toObjectType: event
to Objectid: 47
associationType: event_to_contact
but the response is still:
{
“status”: “error”,
“message”: “Unable to infer object type from: event”,
“correlationId”: “6146c84b-ad12-47ff-a577-710d327b1e3a”
}
Does this really mean that I have to do the PUT request?
I tried this as well:
https://api.hubapi.com/crm/v3/objects/event/2-7111007/associations/contact/0-1/event_to_contact
Unfortunately it says:
{
"status": "error",
"message": "Unable to infer object type from: event",
"correlationId": "b9cf3e62-d566-48ed-be83-db78f92d001a"
}
What am I doing wrong. If someone has hint please let me know.
Thanks!
I would then also need to also transfer or assign the specific association labels I created…
Many thanks and best regards