APIs & Integrations

SS0
Member

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

Hi team,

 

I could need to fetch all the contacts associated with a company, regardless of whether the contact is primary or not using batch association API.

 

https://api.hubapi.com/crm/v3/associations/Companies/Contacts/batch/read

 

{
    "inputs": [
        {
            "id": "...."
        },
        {
            "id": "...."
        }]
}
 
This API fetch only the Primary Contacts of the Company.
All the other Contacts are ignored.
 
Is there any way, I can get all the Contacts of Company through batch read Association API?
0 Upvotes
1 Accepted solution
ChrisMagtoto
Solution
Member | Platinum Partner
Member | Platinum Partner

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

I see. Then you can use v4 for that.

/crm/v4/associations/companies/contacts/batch/read

View solution in original post

0 Upvotes
5 Replies 5
ChrisMagtoto
Member | Platinum Partner
Member | Platinum Partner

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

Hey, you need to make a call to the /crm/v3/objects/companies/{companyId}?associations=contacts then use the result to populate the ids for your batch call to contacts /crm/v3/objects/contacts/batch/read

This way you'll be getting all the associated contacts of a company then you'll be retrieving the info of the contacts which is associated to the company.

0 Upvotes
SS0
Member

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

Thanks for the reply @ChrisMagtoto!

 

This might be a better solution, if we just had to deal with one Contact/Company, 

It won't be an optimized way in my case, though, as I'll have to retrieve the Contact association for hundreds of Companies.

 

Is there a way that we could use Batch Association and achieve the same?

0 Upvotes
ChrisMagtoto
Member | Platinum Partner
Member | Platinum Partner

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

Yes. You can use the batch endpoint for the Associations but if you need to retrieve the properties of the contacts then you will still need to call the batch endpoint for the Contacts object. You'll still make 2 calls (Associations "associations/companies/contacts/batch/read" & Contacts endpoints) in the API to retrieve the data of a batch contacts.

0 Upvotes
SS0
Member

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

But that's the issue here @ChrisMagtoto .
We don't get the non-primary associations in the batch association endpoint. ('associations/companies/contacts/batch/read')

0 Upvotes
ChrisMagtoto
Solution
Member | Platinum Partner
Member | Platinum Partner

Get every contact associated with a company, regardless of whether the contact is primary or not.

SOLVE

I see. Then you can use v4 for that.

/crm/v4/associations/companies/contacts/batch/read

0 Upvotes