5.1.5 api system time

The /api/system/time function is used for device time retrieval or setting.

You can use the GET method for data retrieval and the PUT method for configuration upload.

GET method

The function is part of the System service and the user has to be assigned the System (Monitoring) privilege for authentication if required.

No parameters are defined for the GET method.

The response is in the application/json format and includes the device real time in seconds from 00:00 1.1.1970 (unix time). 

Example:

GET /api/system/time
{
  "success" : true,
  "result" : {
    "utcTime" : 1639472172,
    "source" : "My2N",
    "automatic" : true,
  }
}

PUT method

Caution

  • We recommend that this endpoint is used for time setting only in case the Use time from Internet parameter is disabled. If it is enabled, the time value is overwritten with a value from the NTP server or the My2N time service.

The function is part of the System service and the user has to be assigned the System (Control) privilege for authentication if required.

Request parameters for PUT:

Parameter

Description

automatic

automatic time retrieval from NTP server

If true is completed, no more parameters are entered.

utcTime

number = unix time, min 0, max 2147483647 

server

NTP Server Address (IPv4 address or domain)

The reply is in the application/json format.

PUT /api/system/time?automatic=0&server=pool.ntp.org&utcTime=1700829813{ "success" : true, }