I am trying to retrieve a contact via the API based on the value of a custom property. This works fine if the custom poperty is of type: “Single line text”.
const response = await hubspotClient.apiRequest({
method: 'post',
path: '/crm/v3/objects/contacts/search',
body: {
"filterGroups": [
{
"filters": [
{
"propertyName": 'original_hubspot_id',
"operator": "EQ",
"value": "whatever"
}
]
}
]
}
});
But if the property is of type “Numeric → Unformatted”, it won’t work. I tried as follows:
Without quotes:
"filters": [
{
"propertyName": 'original_hubspot_id',
"operator": "EQ",
"value": 4321
}
With quotes:
"filters": [
{
"propertyName": 'original_hubspot_id',
"operator": "EQ",
"value": "4321"
}
None of both options work. It returns 0 results, but I know that results exist.
Hey, @alvarofranz
Thanks for your question and for including your example.
I set up a quick test and was able to return a result without issue. Here are my steps:
-
Created a new custom Contact property
-
The format was Number – unformatted
-
Gave it the internal value of original_hubspot_id
-
Went to a test contact and gave it a value of `0123456789`
-
Used Postman to send the request
POST https://api.hubapi.com/crm/v3/objects/contacts/search
{
"filterGroups": [
{
"filters": [
{
"propertyName": "original_hubspot_id",
"operator": "EQ",
"value": "0123456789"
}
]
}
]
}
-
Response
{
"total": 1,
"results": [
{
"id": "901",
"properties": {
"createdate": "2022-11-03T21:42:31.255Z",
"email": "bob@bobsburgers.com",
"firstname": "Bob",
"hs_object_id": "901",
"lastmodifieddate": "2024-01-08T22:26:13.194Z",
"lastname": "Belcher"
},
"createdAt": "2022-11-03T21:42:31.255Z",
"updatedAt": "2024-01-08T22:26:13.194Z",
"archived": false
}
]
}
Can you check your formatting and try again?
Best,
Jaycee