Hello,
I have used below end point for retrieve my custome object (partner) record.
https://api.hubapi.com/crm/v3/objects/{object}/{recordId}?properties=app_name
I have received success response with “app_name” property.
now I want associated companies into the response so which property I need to pass as a query string parameter? or any saperate end point for this?
Hi @sshahdev,
You can do this by adding the “associations” query parameter to your request. For instance if I wanted to retrieve a contact along with the associated company I would make a request like this:
GET https://api.hubapi.com/crm/v3/objects/contact/101?properties=app_name&associations=company
RESPONSE
{
"id": "101",
"properties": {
"app_name": "HubSpot",
"createdate": "2023-07-20T16:28:37.941Z",
"hs_object_id": "101",
"lastmodifieddate": "2023-08-17T08:00:37.038Z"
},
"createdAt": "2023-07-20T16:28:37.941Z",
"updatedAt": "2023-08-17T08:00:37.038Z",
"archived": false,
"associations": {
"companies": {
"results": [
{
"id": "8109465573",
"type": "contact_to_company"
},
{
"id": "8109465573",
"type": "contact_to_company_unlabeled"
}
]
}
}
}
The respone returns the associated company ID and to retrieve further information I can use the CRM API Company endpoints if required.
GET https://api.hubapi.com/crm/v3/objects/company/8109465573?properties=numberofemployees
RESPONSE
{
"id": "8109465573",
"properties": {
"createdate": "2023-07-20T13:25:52.999Z",
"hs_lastmodifieddate": "2023-08-16T14:33:56.468Z",
"hs_object_id": "8109465573",
"numberofemployees": "5000"
},
"createdAt": "2023-07-20T13:25:52.999Z",
"updatedAt": "2023-08-16T14:33:56.468Z",
"archived": false
}