Hello everybody,
I’m trying to perform a search on Deals, using the API’s Search method.
The search requires 3 parameters in the filters. However, one of these parameters uses the “NOT_IN” operator, as I need the return of all deals from the conditional, except deals that are in specific dealstages, as shown in the body of the request:
async function getDealByMatricula() {
try {
filterGroup = {
filters: [
{propertyName: 'matricula', operator: 'EQ', value: matricula},
{propertyName: 'associations.contact', operator: 'EQ', value: contactId},
{propertyName: 'dealstage', operator: 'NOT_IN', values: ['429127', '48914296']}
]
};
const properties = ['matricula'];
const limit = 1;
const dealObjectSearch = { filterGroups: [filterGroup], properties, limit };
const dealSearchResponse = await hubspotClient.crm.deals.searchApi.doSearch(dealObjectSearch);
console.log(JSON.stringify(dealSearchResponse.body.results));
if (dealSearchResponse.body.results.length > 0) {
return dealSearchResponse.body.results[0].id;
} else {
return null;
}
} catch (err) {
throw err;
}
}
When calling the method, HubSpot responds with a 400 error, with the message:
“Invalid input JSON on line 1, column 214: operator NOT_IN requires values.”
When I use Postman, I get the expected result. I can’t see where the error is.
Can someone help me?
Thanks,