APIs & Integrations

Jmuller
Member

Marketing events DateTime ISO8601 format

Hi, I'm developing an integration with HubSpot Marketing events. I'm using the marketing API to create them and I was wondering how to give a timezone in the ISO8601 format.

 

I'm passing the datetime in a JSON body as part of an API request like this:

"startDateTime": "2022-03-28T17:00:00.000+01:00"
"startDateTime": "2022-03-28T17:00:00.000+0100"
"startDateTime": "2022-03-28T17:00:00.000+01"

But so far none of them have worked, I keep getting back an error that it is not in the correct format. the only request that works is if I just give it as Zulu time (GMT):

"startDateTime": "2022-03-28T17:00:00.000Z"

I can work around it by changing the time to my timezone, adding the hours and then passing it to the request body but I was wondering if it was possible this way.

 

Error:

"Invalid input JSON on line 5, column 22: Cannot construct instance of `com.hubspot.apiutils.core.models.time.Iso8601Instant`, problem: Failed to parse {{ timestamp }} as an ISO8601 string"

 

I tried passing the datetime in milliseconds but it doesn't accept that format.

 

Anyone have an idea how I could do this?

0 Upvotes
1 Reply 1
dennisedson
HubSpot Product Team
HubSpot Product Team

Marketing events DateTime ISO8601 format

@Jmuller 

You can construct the timestamp using the example on the endpoints tab under "create a marketing event"

Mouse_Highlight_Overlay.png

0 Upvotes