- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Error using Java API to update list filters
SOLVEJun 12, 2019 11:48 AM
I am attempting to update a filter daily, using the Java API.
The field is a date field, called membership_end_date.
When I attempt to do this using java, I get this error message:
Dates with greater than filters must specify the end of the day as the timestamp
My date, in milliseconds, is set to the end of the current day:
1560398399999
Which, in plain text, is...
Wed Jun 12 23:59:59 EDT 2019
Here is my JSON:
{ "name": "Active Members List", "filters": [ [ { "withinTimeMode": "PAST", "filterFamily": "PropertyValue", "property": "membership_end_date", "type": "date", "value": 1560398399999, "operator": "IS_NOT_EMPTY" }, { "withinTimeMode": "PAST", "filterFamily": "PropertyValue", "property": "membership_end_date", "type": "date", "value": 1560398399999, "operator": "GT" }, { "withinTimeMode": "PAST", "filterFamily": "PropertyValue", "property": "current_membership", "type": "string", "value": "Membership", "operator": "CONTAINS" } ] ] }
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Jun 14, 2019 12:53 PM
I'm generating this timestamp with Java.
1560571199999 Fri Jun 14 23:59:59 EDT 2019
Also, 1560398399999 comes out to Wed 12 June 2019
23:59:59 when I use an online date converter.
Check your numbers again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Jun 14, 2019 1:28 PM
Hi, @mclayton.
My numbers are correct. You must use a timestamp that reflects 23:59:59.999 in UTC/GMT 0:00 on the desired date, not 23:59:59.999 in your local time zone (e.g. EDT,or UTC -4:00).
When I attempt to update one of my own list filters with the EDT timestamp 1560916799999
(Tuesday, June 18, 2019 at 23:59:59.999 EDT):
{ "filters": [ [ { "withinTimeMode": "PAST", "operator": "GT", "filterFamily": "PropertyValue", "type": "date", "property": "custom_date_picker", "value": 1560916799999 } ] ] }
... I receive the following error:
{ "status": "error", "message": "Dates with greater than filters must specify the end of the day as the timestamp", "correlationId": "fb2eba9a-6015-427c-9989-7cbeae9fced0", "requestId": "eda7e04e7010e7959ae4ad6cce1d39a1" }
However, when I use a timestamp reflecting Tuesday, June 18, 2019 at 23:59:59.999 in the UTC/GMT time zone — 1560902399999
:
{ "filters": [ [ { "withinTimeMode": "PAST", "operator": "GT", "filterFamily": "PropertyValue", "type": "date", "property": "custom_date_picker", "value": 1560902399999 } ] ] }
...I receive a 200
response and the update takes.
Isaac TakushiAlumnus, HubSpot Developer Support |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content