I am fetching deals of a contact using contact vid through CRM Associatons API. It is returning all the deals of the contact with no particular order. How can I get recent five deals of a contact using this API?
Thanks,
Shwetansh
I am fetching deals of a contact using contact vid through CRM Associatons API. It is returning all the deals of the contact with no particular order. How can I get recent five deals of a contact using this API?
Thanks,
Shwetansh
Hi @Shwetansh07
Unfortunately the CRM Associations endpoint does not return results in any particular order.
If you’re looking to get the most recent deals, you can use the GET Recently Modified Deals endpoint found here:
https://developers.hubspot.com/docs/methods/deals/get_deals_modified
From their, you will be able to filter the resulting response via the VID associated to the Contact in question.
The number of results returned when using this can also be controlled using the &count=X query string like this:
https://api.hubapi.com/deals/v1/deal/recent/modified?hapikey={{hapikey}}&count=1
This will allow you to control the number of results returned but it’s worth noting, you will still need to parse through to find the deals specifically associated to the contact using it’s VID.
I hope this helps!