APIs & Integrations

iaa
Mitglied

Get associations with deals from crm objects deals search endpoint

lösung

Hello,

 

I'm working on interation with Hubspot's API in order to extract our deals using the 

"https://api.hubapi.com/crm/v3/objects/deals/search" endpoint.

 

Example query params:

properties: ['dealname', 'amount', 'closedate', 'pipeline', 'dealstage', 'hs_createdate', 'hs_lastmodifieddate',
'createdate', 'hubspot_owner_id', 'dealname', 'dealstage', 'hs_is_closed', 'hs_closed_amount',
'associations.company'],
filterGroups: [
{
filters: [
{
"propertyName": "closedate",
"operator": "GTE",
"value": start * 1000,
},
{
"propertyName": "hs_is_closed",
"operator": "EQ",
"value": true,
},
{
"propertyName": "associations.company",
"operator": "HAS_PROPERTY",
},
],
}

 

It worked fine except to the fact that at this endpoint, it doesn't return association.
I tried to add "associations=deals".
 
 

Thank you,

Alex.

0 Upvotes
1 Akzeptierte Lösung
WendyGoh
Lösung
HubSpot Employee
HubSpot Employee

Get associations with deals from crm objects deals search endpoint

lösung

Hey @iaa,

 

When looking to retrieve associations between objects, you would need to use this endpoint - CRM API | Associations. Specifically the 'Read a batch of associations' endpoint  - something like this:

 

POST URL - https://api.hubspot.com/crm/v3/associations/DEALS/CONTACTS/batch/read?hapikey={{hapiKey}}

 

POST Body - 

{"inputs":[{"id":"{{dealId}}"}]}

Hope this helps and do let me know if you've any further questions on this!

Lösung in ursprünglichem Beitrag anzeigen

11 Antworten
KSoenandar
Teilnehmer/-in

Get associations with deals from crm objects deals search endpoint

lösung

@WendyGoh - how is this still not available? If we use the /objects/deals endpoint it allows us to pull associations but it doesn't allow filtering, which means we need to do a ridiculously high number of API calls to sync with our warehouse. Conversely, if we use /objects/deals/search endpoint, we can filter but not pull associations and to pull the associations, you recommended us to use another endpoint that doesn't allow filtering. This defeats the purpose of having the search endpoint to begin with, don't you think?

mmaddiona
Mitwirkender/Mitwirkende

Get associations with deals from crm objects deals search endpoint

lösung

Any news about this topic?

nikodev
Stratege/Strategin | Elite Partner
Stratege/Strategin | Elite Partner

Get associations with deals from crm objects deals search endpoint

lösung

Exposing the properties of the associated objects beyond the ID via the dedicated Associations API would allow for programmatic filtering of the response once it's received. Lots of paging though...although I don't recall whether or not the Associations API has pagination implemented.  

A8 Labs

0 Upvotes
nikodev
Stratege/Strategin | Elite Partner
Stratege/Strategin | Elite Partner

Get associations with deals from crm objects deals search endpoint

lösung

Adding this functionality would be incredibly useful. 

A8 Labs

PowerMyAnalytic
Stratege/Strategin

Get associations with deals from crm objects deals search endpoint

lösung

@WendyGoh Please reply to me.

I see that this issue is across all the Search endpoints - in the "get all" endpoint you can use query parameter of associations and in the search endpoint you can't. Why? 

PowerMyAnalytic
Stratege/Strategin

Get associations with deals from crm objects deals search endpoint

lösung

@WendyGoh jumping

0 Upvotes
MFoxcroft
Mitglied

Get associations with deals from crm objects deals search endpoint

lösung

Hi, 

 

What does "jumping" mean? 

 

We are experiencing the sae challenge as listed on this post (https://community.hubspot.com/t5/APIs-Integrations/Get-associations-with-deals-from-crm-objects-deal...

 

How do we bulk get associations?

 

Thanks 

0 Upvotes
WendyGoh
Lösung
HubSpot Employee
HubSpot Employee

Get associations with deals from crm objects deals search endpoint

lösung

Hey @iaa,

 

When looking to retrieve associations between objects, you would need to use this endpoint - CRM API | Associations. Specifically the 'Read a batch of associations' endpoint  - something like this:

 

POST URL - https://api.hubspot.com/crm/v3/associations/DEALS/CONTACTS/batch/read?hapikey={{hapiKey}}

 

POST Body - 

{"inputs":[{"id":"{{dealId}}"}]}

Hope this helps and do let me know if you've any further questions on this!

JZwarthoed
Teilnehmer/-in

Get associations with deals from crm objects deals search endpoint

lösung

The https://api.hubspot.com/crm/v3/associations/DEALS/CONTACTS/batch/read?hapikey={{hapiKey}} endpoint doesn't event exist in the documentation. They are all with a required objectId, while we are trying to get the associations of multiple objectIds. 

PowerMyAnalytic
Stratege/Strategin

Get associations with deals from crm objects deals search endpoint

lösung

Hi @WendyGoh 

 

This solution is not straightforward.

 

When we use the crm/v3/objects/deals endpoint we can just add query parameter of &associations=contacts to get this info (Please see https://community.hubspot.com/t5/APIs-Integrations/Get-associations-with-deals-from-crm-objects-deal...).

 

Please enable it with the crm/v3/objects/deals/search endpoint too.

It will be very helpful!

siempeters
Teilnehmer/-in

Get associations with deals from crm objects deals search endpoint

lösung

Exactly this!