Question: Parsing DateTime when posting via API to Mendix

0
Hello everyone, Im struggling to send the correct DateTime to my mendix application.   Basically I have an ETL-Tool that sends Data via API to my mendix database. One of the attributes is an attribute called “lastUpdate” and its supposedly formatted as “DateTime” – however I always get a parsing error when sending it through the API.   Apparently mendix does not accept that format as a correct “DateTime” . My question is what format does Mendix exaclty use, since i can change the format in my ETL-Tool. Or does it make more sense to send it as a string and then parse it via microflow in the mapping?   Looking forward to any idea!   Greetings Markus
asked
2 answers
0

I think you should send the long number which is milliseconds elapsed since the EPOCH
I made a small app as i was interested in this too. See if you can get some help from this: https://drive.google.com/file/d/1BqcGKbCg1a-YxY31baYz7e8VBAb9vdn4/view?usp=share_link

Once you have the application, run it. Then i made a rest service which you can check and execute by running the SWAGGER console at http://localhost:8080/rest-doc/rest/myservice/v1

When you call it with the right data (See below example of the JSON request body that you have to pass to this service), you open the mendix app and from the side navigaiton there is an Overview page which has the newly inserted data.
// 1678967680627 == current EPOCH

{
 "startDate": "1678967680627"
​​​​​​​}

Let me know if it helped

answered
0

Hi Markus,

 

Can you share the date time format which you are sending to Mendix through API?

answered