This is to help - @YTintpulver Based on this original post,
We tried few fixes and it didnt help much to solve - if anyone have any additional thoughts - please chime in:
HubSpot Community - Re: Get Details of Assocation - HubSpot Community
This is probably pretty straight forward, but I’m banging my head on something that’s probably silly.
I’ve called /crm/v3/associations/{fromObjectType}/{toObjectType}/batch/read and retrieved all the company_to_email association records for a specific company. It returns a simple JSON list {“id”:“19351”,“type”:“company_to_contact”}.
My question is, how do I find out the details of association 19351. I’d like to get the contact / email details of that assocation.
Regards
When calling the/
crm/v3/associations/{fromObjectType}/{toObjectType}/batch/read
associations endpoint, the returned data looks like this:
HTTP 200
{
"status": "COMPLETE",
"results": [
{
"from": {
"id": "8117731364"
},
"to": [
{
"id": "29005864051",
"type": "company_to_email"
}
]
}
],
"startedAt": "2024-07-03T18:14:47.297Z",
"completedAt": "2024-07-03T18:14:47.307Z"
}
In the return the
“from”: {“id”: “8117731364”}
is the id of the originating object that you passed into the call as a parameter.
In
“to”: [{“id”: “29005864051”,“type”: “company_to_email”}]
, the id is the hs_object_id of the associated object. There can be many objects inside of the “to” array. You’d then use that id to call a crm object endpoint (i.e.
/crm/v3/objects/emails/{emailId}
for emails) to get the details of the associated object.
When you call /crm/v3/associations/{fromObjectType}/{toObjectType}/batch/read, the info returned looks like this:
"results": [
{
"from": {
"id": "37295"
},
"paging": {
"next": {
"link": "string",
"after": "string"
},
"prev": {
"before": "string",
"link": "string"
}
},
"to": [
{
"id": "172859",
"type": "contact_to_company"
}
]
}
],
The from id is the id of the source object that you passed as a parameter. The to id is the hs object id of the associated object. Since “to” is an array with an object inside, there can be multiple ids, each representing an associated object.
To get the details of the associated object, you’d use the id to pull from the crm object api. (/crm/v3/objects/emails/{Id} for emails)