Start a new topic
Answered

Getting Error while loading Timestamp field through REST API

Hi ,

I am trying to load data to an Entity through REST API. This entity has a Timestamp field.

 Thouh I am able to load the Data without the timestamp value.

 But I am getting following error while trying to load the Timestamp field.

 "errorMessage" : "Unable to parse value [2020-01-01T00:00:00Z] as a date (for expression [IncorporationFormationDate])"

 I was looking for details in Smearchy document for any guidance , I have found below statement regarding that.

 "The REST API uses the ECMAScript standard format (YYYY-MM-DDTHH:mm:ss.sssZ) for timestamps.

 This format includes an explicit timezone component, and conversion is performed automatically."

 Please suggest me a solution for this.


Thank you very Much,

Kousik


Best Answer

Hello Kousik,


As the error message says-  "Unable to parse value [2020-01-01T00:00:00Z] as a date (for expression [IncorporationFormationDate])" 

You have missed '.sss' in the value and that's why it is throwing the error, The format is as follows: YYYY-MM-DDTHH:mm:ss.sssZ 

 You check the generated REST API endpoint and structure, the format is explicitly defined there : 


You can have a value like this-2020-01-01T00:00:00.000Z


Thank you.


Answer

Hello Kousik,


As the error message says-  "Unable to parse value [2020-01-01T00:00:00Z] as a date (for expression [IncorporationFormationDate])" 

You have missed '.sss' in the value and that's why it is throwing the error, The format is as follows: YYYY-MM-DDTHH:mm:ss.sssZ 

 You check the generated REST API endpoint and structure, the format is explicitly defined there : 


You can have a value like this-2020-01-01T00:00:00.000Z


Thank you.


1 person likes this

As a side note, the exact formatting depends on your database type and column type. For such errors the first troubleshooting step should be to check the type and desired format of the targeted column. If you need to implement an explicit cast, the DB documentation is the best place to look for the exact syntax

Login to post a comment