APIs & Integrations

SBeranek
Participant

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

 

NO result:

curl --request POST   --url https://api.hubapi.com/crm/v3/objects/contacts/search \
--header 'authorization: Bearer ###### --header 'content-type: application/json' \
--data '{
"filterGroups": [
{
"filters": [
{
"operator": "IN",
"propertyName": "nav_guid",
"values": ["FD291D3E-F357-49BA-87D4-EA0E6234EB57"]
}
]
}
],
"properties": [
"nav_guid"
]
}'
{"total":0,"results":[]}

WORKS:

curl --request POST   --url https://api.hubapi.com/crm/v3/objects/contacts/search \
--header 'authorization: Bearer ###### --header 'content-type: application/json' \
--data '{
"filterGroups": [
{
"filters": [
{
"operator": "EQ",
"propertyName": "nav_guid",
"value": "FD291D3E-F357-49BA-87D4-EA0E6234EB57"
}
]
}
],
"properties": [
"nav_guid"
]
}'
{"total":1,"results":[{"id":"10901","properties":{"createdate":"2022-05-19T13:17:42.678Z","hs_object_id":"10901","lastmodifieddate":"2022-05-19T13:18:37.780Z","nav_guid":"FD291D3E-F357-49BA-87D4-EA0E6234EB57"},"createdAt":"2022-05-19T13:17:42.678Z","updatedAt":"2022-05-19T13:18:37.780Z","archived":false}]}

 

I am a fullstack-developer and I am currently creating a sync-solution from MS-Navision to Hubspot.  

 

I get no result when searching via IN-operator, though the same search with EQ works. What do I have to change? IN is used since I need to have at least a few contacts as a package for perfoemance reasons. Other possibilitys would be to parallelize request to the Hubspot-API up to API-limits, which would produce unnecessary load for both involved systems (Hubspot as well as emitting server).  I am using the PHP-librabry (hubspot/api-client), but to remove possible coding errors on my side, I am trying if this even works via CURL (#### is removed for privacy-reasons, since this contains customer-data)

 

 

 

 Label might be wrong, but since to my knowledge this customer has an Enterprise account with arround 500k contact-volume this seemed most appropriate when browsing the available options.

 

bR, Stefan 

0 Upvotes
1 Accepted solution
assi
Solution
Guide | Diamond Partner
Guide | Diamond Partner

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

Hi @SBeranek,

First, I'm sorry that i was completely misunderstanding everything, please forget my ealier post. It' not completely correct.

 

Then, I tried your situation and got same problem. Finally I handle it with lower case values in request body. Try like this: 

 

 

{
  "operator": "IN",
  "propertyName": "nav_guid",
  "values": ["fd291d3e-f357-49ba-87d4-ea0e6234eb57"]
}

 

 

 

 


CMS Hub NinjaAtsushi Handa
CTO at 100 Inc.
Twitter logo
HubSpot ダイヤモンドパートナー 株式会社100

View solution in original post

0 Upvotes
6 Replies 6
assi
Guide | Diamond Partner
Guide | Diamond Partner

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

Hi @SBeranek .

 

IN operator works when propety type is list (= array), so the type of nav_guid must be list when IN wokrs.

How about CONTAINS_TOKEN operator? Doesn't this suit what you want to do?


CMS Hub NinjaAtsushi Handa
CTO at 100 Inc.
Twitter logo
HubSpot ダイヤモンドパートナー 株式会社100
0 Upvotes
SBeranek
Participant

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

@assi Thank you for this answer - which type with a not pre-defined list of options are you referring to with "list" ? I need multiple values here and have just simplified this example to one, therefore I presume "CONTAINS TOKEN" does not apply here in a useful way - please correct me if there is a way to use multiple values with "CONTAINS TOKEN".

screenshot.png

assi
Solution
Guide | Diamond Partner
Guide | Diamond Partner

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

Hi @SBeranek,

First, I'm sorry that i was completely misunderstanding everything, please forget my ealier post. It' not completely correct.

 

Then, I tried your situation and got same problem. Finally I handle it with lower case values in request body. Try like this: 

 

 

{
  "operator": "IN",
  "propertyName": "nav_guid",
  "values": ["fd291d3e-f357-49ba-87d4-ea0e6234eb57"]
}

 

 

 

 


CMS Hub NinjaAtsushi Handa
CTO at 100 Inc.
Twitter logo
HubSpot ダイヤモンドパートナー 株式会社100
0 Upvotes
SBeranek
Participant

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

WOW! That really was the solution! Thanks alot!

assi
Guide | Diamond Partner
Guide | Diamond Partner

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

I'm glad to solve your problem ! (☝ ՞ਊ ՞)☝

HubSpot API sometimes has weird implicit rules...


CMS Hub NinjaAtsushi Handa
CTO at 100 Inc.
Twitter logo
HubSpot ダイヤモンドパートナー 株式会社100
0 Upvotes
YoungHitch
Participant

API v3-Search via custom property with IN operator no result, but works with EQ

SOLVE

Thanks so much for this solution Assi! This was blocking me for about a week!

 

Its pretty cooked that this isn't noted in the Search API documentation