Dates with Rest API -company

companies

#1

hi,
I’m interested in 3 end points for Company

All - /companies/v2/companies/paged
Recently Created - /companies/v2/companies/recent/created
Recently Modified - /companies/v2/companies/recent/modified

I was wondering, is tehre a way to get ALL companies up to, say, This morning at 00:00:00 and then use the other 2 end points to get recently created and recently updated, say every 6 hours thereafter?

I don’t seem to see a ‘date’ field in the json response that I can filter on


#2

Hi @Olumide_Adebayo

The two /recent endpoints always start with the most recently created or updated records, so you’d want to page backwards through the records checking the createdate or hs_lastmodifieddate properties of the returned records to determine when you had all of the newly created or updated records since the last time you checked.

The general idea would be to use the /companies/v2/companies/paged for your initial sync, then one of the /recent endpoints to get updates after that.

Also, the /companies/v2/companies/recent/modified endpoint would also include newly created records, so if you wanted all updates and new records, you would only need to use that one endpoint.


#3

hi, thank a lot for the update.

was wondering…i know user defined field are nested inside ‘properties’ but is it possible to have a list of all Hubspot defined fields per each end point? For example, when I see properties.hs_lastmodifieddate it makes sense to me outrightly that this is a pre-defined field but when I see properties.created, I’m not sure if this is predefined (which means every record will have it) or user defined (which means it might be missing at times.


#4

You can use the Company Properties API to get the details for all company properties, including system and custom properties.

Properties with "hubspotDefined" : true are system properties, anything else would be custom.


#5

Thanx Adam. This has been quite helpful. I have questions on the contact end point, but will open a different thread for that. Thanx once again