NTP Server
The Network Time Protocol (NTP) allows devices to synchronize their internal clocks with time servers over the network. The following endpoints allow configuring and checking the status of the NTP server used by the device.
Get NTP server
Returns the currently configured NTP server addresses.
GET /get_ntp_server.fcgi
Parameters
- This request has no parameters.
Response
- server1 (string): Primary NTP server address.
- server2 (string): Secondary NTP server address. Only present if a second server is configured.
Request example
$.ajax({
url: "/get_ntp_server.fcgi?session=" + session,
type: 'GET',
contentType: 'application/json'
});
Response example
{
"server1": "pool.ntp.org",
"server2": "time.google.com"
}
Set NTP server
Configures the NTP server addresses used for time synchronization.
POST /set_ntp_server.fcgi
Parameters
- server1 (string): Required. Primary NTP server address.
- server2 (string): Secondary NTP server address. Optional.
Response
- This request has no response.
Request example
$.ajax({
url: "/set_ntp_server.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
server1: "pool.ntp.org",
server2: "time.google.com"
})
});
Get NTP server status
Tests connectivity to the configured NTP server and returns the result. This is a blocking call — the response is only returned after the connection attempt completes, with a maximum timeout of 4 seconds.
GET /get_ntp_server_status.fcgi
Parameters
- This request has no parameters.
Response
- server_status (bool):
trueif the NTP server connection was successful,falseotherwise.
Request example
$.ajax({
url: "/get_ntp_server_status.fcgi?session=" + session,
type: 'GET',
contentType: 'application/json'
});
Response example
{
"server_status": true
}