Root /
Root endpoint for basic service health check
/measurements
Compute a live NTP measurement for a given server (IP or domain)
- async server.app.api.routing.read_data_measurement(payload, request, session=Depends(get_db))[source]
Compute a live NTP measurement for a given server (IP or domain).
This endpoint receives a JSON payload containing the server to be measured. It uses the measure() function to perform the NTP synchronization measurement, and formats the result using get_format(). User can choose whether they want to measure IPv4 of IPv6, but this will take effect only for domain names. If user inputs an IP, we will measure the type of that IP.
- Parameters:
payload (MeasurementRequest) –
- A Pydantic model containing:
server (str): IP address (IPv4/IPv6) or domain name of the NTP server.
ipv6_measurement (bool): True if the type of IPs that we want to measure is IPv6. False otherwise.
request (Request) – The Request object that gives you the IP of the client.
session (Session) – The currently active database session.
- Returns:
A json response containing a list of formatted measurements under “measurements”.
- Return type:
JSONResponse
- Raises:
HTTPException – 400 - If the server field is empty or no response.
HTTPException – 422 - If the server cannot perform the desired IP type (IPv4 or IPv6) measurements, or if the domain name could not be resolved.
HTTPException – 503 - If we could not get client IP address or our server’s IP address.
HTTPException – 500 - If an unexpected server error occurs.
Notes
This endpoint is also limited to <see config file> to prevent abuse and reduce server load.
/measurements/history
Fetch historic NTP measurement data for a given server over a specified time range
- async server.app.api.routing.read_historic_data_time(server, start, end, request, session=Depends(get_db))[source]
Retrieve historic NTP measurements for a given server and optional time range.
This endpoint fetches past measurement data for the specified server using the fetch_historic_data_with_timestamps() function. It can optionally filter results based on a time range (start and end datetime).
- Parameters:
server (str) – IP address or domain name of the NTP server.
start (datetime, optional) – Start timestamp for data filtering.
end (datetime, optional) – End timestamp for data filtering.
request (Request) – Request object for making the limiter work.
session (Session) – The currently active database session.
- Returns:
A json response containing a list of formatted measurements under “measurements”.
- Return type:
JSONResponse
- Raises:
HTTPException – 400 - If server parameter is empty, or the start and end dates are badly formatted (e.g., start >= end, end in future).
HTTPException – 500 - If there’s an internal server error, such as a database access issue (MeasurementQueryError) or any other unexpected server-side exception.
Notes
This endpoint is also limited to <see config file> to prevent abuse and reduce server load.
/measurements/ripe/trigger
Initiate a RIPE Atlas NTP measurement for the specified server
- async server.app.api.routing.trigger_ripe_measurement(payload, request)[source]
Trigger a RIPE Atlas NTP measurement for a specified server.
This endpoint initiates a RIPE Atlas measurement for the given NTP server (IP address or domain name) provided in the payload. Once the measurement is triggered, it returns a measurement ID which can later be used to fetch the result using the /measurements/ripe/{measurement_id} endpoint.
- Parameters:
payload (MeasurementRequest) –
- A Pydantic model that includes:
server (str): The IP address or domain name of the target server.
ipv6_measurement (bool): True if the type of IPs that we want to measure is IPv6. False otherwise.
request (Request) – The FastAPI request object, used to extract the client IP address.
- Returns:
- A json response containing:
measurement_id (str): The ID of the triggered RIPE measurement.
status (str): Status message (“started”).
message (str): Instructions on how to retrieve the result.
ip_list (list[str]): List of ips for ntp server.
- Return type:
JSONResponse
- Raises:
HTTPException – 400 - If the server field is invalid.
HTTPException – 500 - If the RIPE measurement could not be initiated.
HTTPException – 502 - If the RIPE measurement was initiated but failed.
HTTPException – 503 - If we could not get client IP address or our server’s IP address.
Notes
This endpoint is also limited to <see config file> to prevent abuse and reduce server load.
/measurements/ripe/{measurement_id}
Retrieve the results of a previously triggered RIPE Atlas measurement
- async server.app.api.routing.get_ripe_measurement_result(measurement_id, request)[source]
Retrieve the results of a previously triggered RIPE Atlas measurement.
This endpoint checks the RIPE Atlas API for a given measurement ID. It determines if the measurement is complete (all probes responded, or measurement was stopped by RIPE Atlas) and returns the data accordingly. If the results are not yet ready, it informs the client that the measurement is still pending, or that partial results have been returned.
- Parameters:
measurement_id (str) – The ID of the RIPE measurement to fetch.
request (Request) – The FastAPI Request object (used for rate limiting).
- Returns:
A JSON-formatted HTTP response containing the measurement status and results:
If the measurement is complete (HTTP 200):
{ "status": "complete", "message": "Measurement has been completed.", "results": "<ripe_data>" }
If the measurement is still in progress with partial data (HTTP 206):
{ "status": "partial_results", "message": "Measurement is still in progress. These are partial results.", "results": "<ripe_data>" }
If the measurement has not produced results yet (HTTP 202):
"Measurement is still being processed."
If the probe responses are incomplete and likely timed out (HTTP 504):
{ "status": "timeout", "message": "RIPE data likely completed but incomplete probe responses." }
- Return type:
JSONResponse
- Raises:
HTTPException – 405 - If the RIPE API request fails (e.g., network or service error).
HTTPException – 500 - If an unexpected internal error occurs during processing.
Notes
A measurement is considered “complete” only when all requested probes have responded.
The endpoint is rate-limited to <see config file> to prevent abuse and manage system load.