I'm trying to make this api request work. In my simulation I have this code which makes an api request to get the exact date and time in the following format 2024-08-30 08:01:00, but when I try to set it, it remains the current one. How can I fix this problem?
Thanks to whoever will reply at this post.
PS: for security reasons, I intentionallly omitted the request link and correspondant key.
/**Set Date and Time*/ Object current = ownerobject(c); Http.Request request = Http.Request("request"); request.method = Http.Method.Get; request.headers = "key"; Http.Response response = request.sendAndWait(); string value = response.value; Map result = JSON.parse(value); Array data = result["data"]; Map firstElement = data[0]; string last_updated = firstElement["last_updated", 1]; DateTime dt=DateTime(last_updated); print(dt); function_s(getmodelunit(START_TIME_NODE), "setDateTime", dt);