Whenever working on integrations, we basically use the APIs to retrieve the information. Some APIs are pretty straightforward to understand, so just by looking at the endpoint we can make out how to use it but sometimes, you need to dig in a bit to understand the usage.
I came across this situation in my application where I wanted to retrieve all the contacts from HubSpot based on a particular property value. For eg. If there is a contact property named Company_Affiliation and I want to retrieve all the contacts with a company affiliation value of say Fictional Company then how should I use the Search API?
The Endpoint
POST
/crm/v3/objects/contacts/search
The Input
const inputHubSpotSearchObject=
{
"objectName":"contacts",
"limitValue":"100",
"afterValue":"0",
"filters":[
{
"value":req.body.company_name,
"propertyName": "company_affiliation",
"operator": "EQ"
}
]
}
The API call
const response = await axios.post(`${process.env.API_URL}/api/hubspot/search`,inputHubSpotSearchObject,
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
}});
The Response
Conclusion
I hope you found this article helpful. For more information visit link
Happy Coding!!!
Top comments (0)