APIs & Integrations

hsop
Membro

Date property through api

Hi,

I'm working as a developer for a company with three brands which in turn use separate Hubspot accounts:

  • 2271809
  • 2266809
  • 3068974

We use your api to create contacts and deals for all three brands using the same piece of code in a single bookingsystem using the same server. Nevertheless we are having trouble creating dates in deals in the 3068974 account. It works fine for the other brands, where dates format as dd/mm/yyyy.

I have tried to export the one of the deal propertys data to csv:
Deal ID,"Deal Name","Arrival Date"
46827404,"6207705","2017-01-28 01:00","2016-10-26 23:35"
46827544,"6207709","2017-01-21 01:00","2016-10-26 23:35"
46827824,"6207720","2016-12-25 01:00","2016-10-26 23:36"
which looks fine.

For 3068974 the same date deal properties format as number Unix timestamp (e.g. 1533686400000) in the Deals UI. I can convert the timestamp to human readable date using https://www.epochconverter.com/

Export of these data:
Deal ID,"Deal Name","Returndate"
250377852,"80460","1517616000000","2018-01-26 08:34"
250377890,"80153","1518825600000","2018-01-26 08:35"
250383874,"80595","1517616000000","2018-01-26 10:08"

I have read https://developers.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis

We have compared the language and date settings of the three accounts and they are the same (as far as I can see), but the issue remains. Hubspot Support wasn't able to help and told me to ask my question here at the Developers forum.

Could you help me solve this issue?

Best regards,
Henrik

0 Avaliação positiva
5 Respostas 5
cara_ceo
Participante

Date property through api

This looks like the solution I need as well, however, when I visit the Deal Property settings for Close Date, I am not given the option to change from a single-line text field to a date field.

I'm the super admin and original creator of our HS account so I don't think its a permission issue. Any insight?

0 Avaliação positiva
Derek_Gervais
Alunos da HubSpot
Alunos da HubSpot

Date property through api

Hi @hsop,

I'm not entirely sure why the other two appear to be formatting correctly, but it appears to be related to the differences in the way that the frontend processes date and datetime values. The two examples you listed above are datetime, so it's possible that the frontend processes them differently. It's tough to compare them at this stage since you've fixed the original property type, but going forward you shouldn't see any issues so long as the property types are set properly to date or datetime.

0 Avaliação positiva
hsop
Membro

Date property through api

Yes, we changed the property field type and now it works. Thank you!

Derek_Gervais
Alunos da HubSpot
Alunos da HubSpot

Date property through api

Hi @hsop,

I jumped into your portal to take a look, and it appears that the returndate property you're seeing issues with isn't a date property, it's a text property. This is why the timestamp values aren't being formatted to dates. Can you jump into your Deal property settings and update the property definition?

https://app.hubspot.com/property-settings/3068974/deal/returndate

hsop
Membro

Date property through api

Hi Derek

Thank you, and I have been wandering about the "Single-line text" Field-Type, too. The thing is I'm working with three Hubspot portals and the other two have the same Field-Type for the returndate property, but not the same problem:
https://app.hubspot.com/property-settings/2266809/deal/returndate
https://app.hubspot.com/property-settings/2271809/deal/returndate

Can you explain why?

0 Avaliação positiva