Hello! I am trying to retrieve all contacts that have a specific set of vids (IDs - canonical or otherwise) via the Search Endpoint and the 'hs_all_contact_vids' property:
{
"updatedAt": "2022-05-27T20:57:17.998Z",
"createdAt": "2019-08-06T02:41:10.764Z",
"name": "hs_all_contact_vids",
"label": "All vids for a contact",
"type": "enumeration",
"fieldType": "select",
"description": "A set of all vids, canonical or otherwise, for a contact",
"groupName": "contactinformation",
"options": [],
"displayOrder": -1,
"calculated": true,
"externalOptions": false,
"hasUniqueValue": false,
"hidden": true,
"hubspotDefined": true,
"modificationMetadata": {
"archivable": true,
"readOnlyDefinition": true,
"readOnlyValue": true
},
"formField": false
}
When retrieving data via "/crm/v4/objects/contacs", as can be seen below 'hs_all_contact_vids' si returned as '201;251'
But why does this occurr? Why does IN work and not EQ? Is there some API usage rule I am missing? Any information on this behavior and how to generally handle it would be appreciated.
Hey, @AB35👋 Thanks for reaching out! This is a great question. The Search API documentation on Search Operators doesn't specify whether the EQ filter will accept multiple values or multiple values as an array.
Questions:
Have you tried using an array in your request using EQ?
For your use case, are the contacts who have multiple values for “hs_all_contact_vids” contacts who've been merged? So, I can try to reproduce on my end if needed.
I understand why the EQ operator makes sense in this case. And I want to clarify if we can leverage it this way, e.g. matching multiple specific values.
Hi, Thank you very much for the reply. I do not know if this behavior is expected, but I tested EQ with only a single value, and it returns the entity in the result.
I also tested the following, but none of them worked:
"value": ["201;251"] -> Invalid input JSON
"value": ["201"] -> Invalid input JSON
"values": ["201"] -> operator EQ requires a value
> For your use case, are the contacts who have multiple values for “hs_all_contact_vids” contacts who've been merged? Yes. The problem can also be reproduced if using a custom property that allows selecting multiple options (Multiple checkboxes).
It seems to me that the API is treating each value as a sub-field of its own even though GET returns them as one semicolon separated list. So, "EQ value" for enumeration types works like 'retrieve all records that have at least this value in that property'.