APIs & Integrations

AMoscato
Participant

How to retrieve all associations having thousands of contacts, and companies, and deals?

SOLVE

I have around 15k contacts, some thousands companies, and 1k deals.

As I want to analyze how they change during time, say to know how many deals changed state inside the pipeline every month, I need to get all deals and all their associations with companies.

I am able to get all deals with

https://api.hubapi.com/crm/v3/objects/deals/

and I can get all companies and contacts too.

I haven't found a way to get all associations. There is

POST/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/read
This solution has some drawbacks: I need to pass an array of ids (how may max?), Associations api is already at version 4, I don't know how much time version 3 is going to be available, and I would like to implement a durable solutions.
Any hints on this?
0 Upvotes
1 Accepted solution
AMoscato
Solution
Participant

How to retrieve all associations having thousands of contacts, and companies, and deals?

SOLVE

I have managed to find a solution.

There is a parameter in getting deals that I didn't see, "associations".

Adding it has solved, as I have all the needed associations inside the deal:

 
{{baseUri}}/crm/v4/objects/deal?limit=100&associations=company,contact&archived=false&properties=amount,dealstage,createdate,closedate,dealname,hubspot_owner_id,hs_object_id,hs_deal_stage_probability,num_notes

inside th deal there is a subsection "associations" that contains all the searched deals

View solution in original post

2 Replies 2
dennisedson
HubSpot Product Team
HubSpot Product Team

How to retrieve all associations having thousands of contacts, and companies, and deals?

SOLVE

@Teun , have you hit a limit, yet?  Any thoughts here?

0 Upvotes
AMoscato
Solution
Participant

How to retrieve all associations having thousands of contacts, and companies, and deals?

SOLVE

I have managed to find a solution.

There is a parameter in getting deals that I didn't see, "associations".

Adding it has solved, as I have all the needed associations inside the deal:

 
{{baseUri}}/crm/v4/objects/deal?limit=100&associations=company,contact&archived=false&properties=amount,dealstage,createdate,closedate,dealname,hubspot_owner_id,hs_object_id,hs_deal_stage_probability,num_notes

inside th deal there is a subsection "associations" that contains all the searched deals