APIs & Integrations

HNunez
Participante

Using the Search api

resolver

Hi there! I was wondering if there is anyone out there that can help me using the Search api. When I use the the filterGroups parameter I get an error with the "operator" params. I have tried all the avaliable options for its value and even I tried setting it at null and still I get errors. Can someone help me please??

 

const PublicObjectSearchRequest = { filterGroups: [{"filters":[{"value":"string","propertyName":"string","operator":"EQ"}]}], sorts: ["string"], query: "string", properties: ["string"], limit: 0, after: 0 };

0 Avaliação positiva
1 Solução aceita
Teun
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

Using the Search api

resolver

Hi @HNunez ,

I tested the code below and it should work:

 

const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"apiKey":"YOUR_HUBSPOT_API_KEY"});

const PublicObjectSearchRequest = { filterGroups: [{"filters":[{"value":"Teun","propertyName":"firstname","operator":"EQ"}]}], sorts: ["firstname"], properties: [["firstname","lastname"]], limit: 0, after: 0 };

try {
  const apiResponse = await hubspotClient.crm.contacts.searchApi.doSearch(PublicObjectSearchRequest);
  console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
  e.message === 'HTTP request failed'
    ? console.error(JSON.stringify(e.response, null, 2))
    : console.error(e)
}

 

Did you fill in all the required params?

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Exibir solução no post original

3 Respostas 3
HNunez
Participante

Using the Search api

resolver

Thank You!!!!!! @Teun 

Teun
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

Using the Search api

resolver

Hi @HNunez ,

I tested the code below and it should work:

 

const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"apiKey":"YOUR_HUBSPOT_API_KEY"});

const PublicObjectSearchRequest = { filterGroups: [{"filters":[{"value":"Teun","propertyName":"firstname","operator":"EQ"}]}], sorts: ["firstname"], properties: [["firstname","lastname"]], limit: 0, after: 0 };

try {
  const apiResponse = await hubspotClient.crm.contacts.searchApi.doSearch(PublicObjectSearchRequest);
  console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
  e.message === 'HTTP request failed'
    ? console.error(JSON.stringify(e.response, null, 2))
    : console.error(e)
}

 

Did you fill in all the required params?

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


RVu
Membro

Using the Search api

resolver

Does this work for custom properties added to a contact?

For example:

{ filterGroups: [{"filters":[{"value": "X3vsi8", "propertyName":"app_user_id", "operator": "EQ"}] }

Does this search api cover custom fields? And what if our custom field is required - does this change anything?

0 Avaliação positiva