We need to fetch the contacts related to any deal from hubspot APIs. We are receiving different responses from the below mentioned APIs for the same deal :-
1. https://api.hubapi.com/crm/v3/objects/deals {dealid}/associations/contact - get 2. https://api.hubapi.com/crm/v3/associations/deal/contact/batch/read - post I received “message”: “No contact is associated with deal {dealid}.” even though the deal has contact associated with it. Kindly suggest which API to use.
Response data for your reference :-
{ “status”: “COMPLETE”, “results”: [], “numErrors”: 1,
“errors”: [ { “status”: “error”, “category”: “OBJECT_NOT_FOUND”,
“subCategory”: “crm.associations.NO _ASSOCIATIONS_FOUND”,
“message”: “No contact is associated with deal 4109207801.”,
“context”: { “fromObjectId”: [ “4109207801” ], “fromObjectType”: [ “deal” ], “toObjectType”: [ “contact” ] } } ], “startedAt”: “2022-01-04T10:35:46.600Z”, “completedAt”: “2022-01-04T10:35:46.605Z” }
@PranayKumar
You should be able to do this
Just tested with this URL.
https://api.hubapi.com/crm/v3/objects/deals/7305618234/associations/contact?limit=500&hapikey={{hapikey} }
Deal ID is from my portal and I get a result of
{
"results": [
{
"id": "43801",
"type": "deal_to_contact"
}
]
}
system
January 10, 2022, 9:44am
3
Hi @PranayKumar ,
step 1 = we can get the number of associated contacts with a deal
by using the API
https://api.hubapi.com/deals/v1/deal/{deal_id}?hapikey=demo
this will give you the associated contacts vid
step 2= and after getting a deal you can get its contacts list also by :
https://api.hubapi.com/contacts/v1/contact/vids/batch/?vid=10&vid=20&hapikey=demo
you can use the upper for max of 100 at a time
for ref check
Step1=https://legacydocs.hubspot.com/docs/methods/deals/get_deal
Step2=https://legacydocs.hubspot.com/docs/methods/contacts/get_batch_by_vid
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.