In the contacts record, there is more than one record which has Lastmodifieddate. Tried with different filters like the first-name and it's working fine with first-name and other filters. below is the request body I'm passing,
and below is the response I'm getting from API
It should give me records matching with Lastmodifieddate but it's giving me an error. The same request is working with filters like first-name, hs_object_id. Please point me to the right path, is there anything that I'm missing? Or filtering with Lastmodifieddate and updatedAt is not supported?
please refer to below Snapshot which supports me that I've records ( contact records ) that have the Lastmodifieddate field with its value.
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
Hi everyone,
I have been working with the HubSpot API as well and these are my findings:
To convert a date to an epoch unix timestamp you can use this simple JavaScript code:
var originalDate = '2020-10-13T15:47:31.233Z'; //original date obtained from any record
var epochDate = Date.parse(originalDate);
var newDate = new Date(epochDate);
console.log(epochDate);
console.log(newDate.toUTCString());
You can use the value of the epochDate variable to retrieve the records you want from HubSpot API, the format of the epoch timestamp should be something like this 1602604051233.
newDate variable is just to verify that the original date does not get affected after the conversion.
I have been using the Search API method for Contacts by calling the following URL:
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
Hi everyone,
I have been working with the HubSpot API as well and these are my findings:
To convert a date to an epoch unix timestamp you can use this simple JavaScript code:
var originalDate = '2020-10-13T15:47:31.233Z'; //original date obtained from any record
var epochDate = Date.parse(originalDate);
var newDate = new Date(epochDate);
console.log(epochDate);
console.log(newDate.toUTCString());
You can use the value of the epochDate variable to retrieve the records you want from HubSpot API, the format of the epoch timestamp should be something like this 1602604051233.
newDate variable is just to verify that the original date does not get affected after the conversion.
I have been using the Search API method for Contacts by calling the following URL:
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
Hi @dennisedson, 1. I checked your created request on postman and getting the same 8 records for companies object but according to me, it is not correct.
In the case of GTE, API returning more than zero records. (expected: should return zero records if I am using the current date.)
In the case of LTE, API returning zero records. (expected: should return more than zero records if I am using the current date.)
2. In case of Contact hs_lastmodifieddate not working. Search API is returning zero records or if I use lastmodifieddate without hs_ in Contacts object then it gives me data.
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
@SakshiChauhan@dennisedson I can confirm I see the same issue - it appears that the GT/GTE/LT/LTE don't work properly using Unix dates as shown in the example. Should we be using a different format?
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
I am seeing something similar - it appears LTE date math doesn't work properly on datetime fields using the unix timestamp as shown above. 0 records are always returned for me as well. GT/GTE seem to work.
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
Hey, @dennisedson thanks for the update. but can you please help me with how can I convert modified_date into Unix timestamp? Below is my modified date of one record that I wanted to search by HubSpot API.
For what it's worth, I have brought this up to the team to consider updating so the methods return a consistent value. Hopefully this will be updated sooner than later!
Getting error while searching/filtering contact object with Lastmodifieddate filed.
SOLVE
HI,
It does not work. Even if I translate string to UnixTime.
If I use lastmodifieddate and "GTE". I get all records regardless of timestamp.
If I use lastmodifieddate and "LTE" I get no records regardless of timestamp.
If I use hs_lastmodifieddate I get no restords regardless of timestamp, operator....
And also value can be as string or as number - it doesn't matter
All I need is api call which will return records that were modified after some arbitrary time. With that I can synchronize local contacts with HubSpot. Just periodically execute function which will return all records that were changed after last call. 😞
Now you can change value to anything and you will always records. I can set value to 0 or 1601544240 or 2601544240 - it doesn't matter. I will always get all records
Now you can change value to anything and you will always records. I can set value to 0 or 1601544240 or 2601544240 - it doesn't matter. I will always get all records