Using the BETWEEN search operator for two dates

Hi, we’re trying to write a “get records updated between X and Y dates” interface with the HubSpot API but are finding the BETWEEN operator a bit confusing. The documentation is very light on the ground on how to use it.

Polling /crm/v3/objects/tasks/search, here’s the JSON body.

{
 "filterGroups":[
 {
 "filters":[
 {
 "propertyName":"hs_lastmodifieddate",
 "operator":"BETWEEN",
 "values":[
 "2022-03-01T00:00:00.000Z",
 "2022-04-01T00:00:00.000Z"
 ]
 }
 ]
 }
 ],
 "properties":[
 "hs_timestamp",
 "hs_task_status",
 "hs_lastmodifieddate"
 ]
}

This is turning up this error.

“Invalid input JSON on line 12, column 5: Cannot construct instance of `com.hubspot.inbounddb.publicobject.core.v3.search.Filter`, problem: Error validating request.”

Any suggestions? I’ve tried changing from “values” to “value” (and get an array-based error), changing to look at hs_timestamp as a test with numerical values. No joy.

Thanks

@Dezachu
Replace that values array with two new key value pairs.

“highValue”: xxx,

“value”: xxx

You will also probably need to convert those timestamps into unix timestamps in milliseconds

Lovely, thanks Dennis.