Hi David,
Really good Q ;)… good one.
Ok my idea :
First in order to to the Query you can create via API POST/CONTACTS/v1/lists a static or dynamic list with the values you request.
Second, you should have to request list memberships in order to get the results.
reference: https://legacydocs.hubspot.com/docs/methods/lists/create_list
This API call is going to be update in the near future by the new ones.
Example of this.
Here is an example of some more complex filters. This list
will include all contacts named Alice who have filled out
a certain form on a certain landing page after April 12, 2013
as well as all contacts with a lifecycle stage of lead,
salesqualifiedlead, or marktingqualifiedlead who have
filled out more than three forms.
{
"name": "My Wacky List",
"dynamic": true,
"portalId": 62515,
"filters":
[
[
{
"operator": "EQ",
"value": "Alice",
"property": "firstname",
"type": "string"
},
{
"operator": "HAS_FILLED_OUT_FORM",
"form": "92364e25-6aa7-46f0-bfb0-aacbb537513d",
"page": "19612330",
"afterTimestamp": "1365739200000"
}
],
[
{
"operator": "SET_ANY",
"value": "lead;salesqualifiedlead;marketingqualifiedlead",
"property": "lifecyclestage",
"type": "string"
},
{
"operator": "GT",
"computedProperty": "NUMBER_OF_FORMS_FILLED_OUT",
"value": "3",
"type": "number"
}
]
]
}
If the request succeeds, you'll get an HTTP 200 response with
a JSON object, which represents the new list that you've just
created in the system. At first, you'll notice that the
'metaData -> processing' field has a value of 'INITIALIZING',
which means that a dynamic list is processing and building itself.
This can take a bit of time, depending on the size of your list.
Once the list has finished processing, that field will be set
to a 'DONE' value and the 'metaData -> size' value will grow
with the amount of contacts that are in the list.
Here's the JSON response from the request made with JSON above:
{
"name": "tweeters",
"internalListId": 6,
"listId": 6,
"deleted": false,
"dynamic": true,
"portalId": 56043,
"filters": [
[
{
"operator": "EQ",
"property": "twitterhandle",
"type": "string",
"value": "@hubspot"
}
]
],
"updatedAt": 1335387180052,
"createdAt": 1335387180052,
"metaData": {
"lastProcessingStateChangeAt": 1335387180052,
"processing": "INITIALIZING",
"lastSizeChangeAt": 0,
"error": "",
"size": 0
}
}
Please note this is a walk-arround as @DavidThielen mention.
Let me know if this helps!,. if yes please say it!
KR
JP
