RPC API
All database records are returned in CSV format by default, with content type
text/comma-separated-values. Status and error messages are returned as
key–values pairs, with content type text/plain.
The following HTTP endpoints are provided by the RPC API:
| Endpoint | HTTP Method | Description |
|---|---|---|
|
GET |
|
|
GET |
|
|
GET |
|
|
GET |
|
|
GET |
|
|
GET |
|
|
GET |
|
|
GET |
|
|
GET, POST |
|
|
GET, POST |
|
|
GET, POST |
|
|
GET, POST |
|
|
GET, POST |
|
|
GET, POST |
Read Service Status
Returns service status in API status format as text/plain.
Endpoint
-
/api/v1/
HTTP Methods
-
GET
Responses
| Status | Description |
|---|---|
|
Default response. |
|
Unauthorised. |
|
Server error. |
Example
Return the HTTP-RPC service status:
$ curl -s -u <username>:<password> --header "Accept: text/plain" \ "http://localhost/api/v1/"
Read Beats
Endpoint
-
/api/v1/beats -
/api/v1/beats?header=<0|1>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
integer |
Add CSV header (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Beats are returned. |
|
Unauthorised. |
|
No beats found. |
|
Server error. |
|
Database error. |
Example
Return beats of all nodes in JSON format, pretty-print the result with jq(1):
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/beats" | jq
Read Logs
Returns logs of a given node and time range in CSV, JSON, or JSON Lines format from database. Node id and time range are mandatory.
Endpoint
-
/api/v1/logs?node_id=<id>&from=<timestamp>&to=<timestamp>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Node id. |
|
string |
Start of time range (ISO 8601). |
|
string |
End of time range (ISO 8601). |
|
integer |
Add CSV header (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Logs are returned. |
|
Invalid request. |
|
Unauthorised. |
|
No logs found. |
|
Server error. |
|
Database error. |
Example
Return all logs of node dummy-node and year 2023 in CSV format:
$ curl -s -u <username>:<password> --header "Accept: text/comma-separated-values" \ "http://localhost/api/v1/logs?node_id=dummy-node&from=2023&to=2024"
Read Nodes
Endpoint
-
/api/v1/nodes -
/api/v1/nodes?header=<0|1>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
integer |
Add CSV header (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Nodes are returned. |
|
Unauthorised. |
|
No nodes found. |
|
Server error. |
|
Database error. |
Example
Return all nodes in database as JSON array:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/nodes"
Read Observations
Returns observations of given node, sensor, target, and time range from database, in CSV, JSON, or JSON Lines format.
Endpoint
-
/api/v1/observs?<parameters>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Node id. |
|
string |
Sensor id. |
|
string |
Target id. |
|
string |
Response name. |
|
string |
Start of time range (ISO 8601). |
|
string |
End of time range (ISO 8601). |
|
integer |
Max. number of results (optional). |
|
integer |
Add CSV header (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Observations are returned. |
|
Invalid request. |
|
Unauthorised. |
|
No observations found. |
|
Server error. |
|
Database error. |
Example
Return all observations related to node dummy-node, sensor dummy-sensor, and
target dummy-target of a single month in JSON format, pretty-print the result
with jq(1):
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/observs?node_id=dummy-node&sensor_id=dummy-sensor\ &target_id=dummy-target&from=2023-01&to=2024-01" | jq
Read Sensors
Endpoint
-
/api/v1/sensors -
/api/v1/sensors?header=<0|1>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
integer |
Add CSV header (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Sensors are returned. |
|
Unauthorised. |
|
No sensors found. |
|
Server error. |
|
Database error. |
Example
Return all sensors of node dummy-node in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/sensors?node_id=dummy-node"
Read Targets
Endpoint
-
/api/v1/targets -
/api/v1/targets?header=<0|1>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
integer |
Add CSV header (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Targets are returned. |
|
Unauthorised. |
|
No targets found. |
|
Server error. |
|
Database error. |
Example
Return all targets in CSV format:
$ curl -s -u <username>:<password> --header "Accept: text/comma-separated-values" \ "http://localhost/api/v1/targets"
Read Time Series
Returns time series as observation views or data points (X/Y records) in CSV format from database. In comparison to the observation endpoint, the time series include only a single response, selected by name.
Endpoint
-
/api/v1/timeseries?<parameters>
HTTP Methods
-
GET
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Node id. |
|
string |
Sensor id. |
|
string |
Target id. |
|
string |
Response name. |
|
string |
Start of time range (ISO 8601). |
|
string |
End of time range (ISO 8601). |
|
integer |
Max. number of results (optional). |
|
integer |
Add CSV header (0 or 1). |
|
integer |
Return observation views instead of data points (0 or 1). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
Responses
| Status | Description |
|---|---|
|
Observations are returned. |
|
Invalid request. |
|
Unauthorised. |
|
No observations found. |
|
Server error. |
|
Database error. |
Example
Return time series of responses dummy related to node dummy-node, sensor
dummy-sensor, and target dummy-sensor, from 2023 to 2024, as X/Y data in CSV
format:
$ curl -s -u <username>:<password> --header "Accept: text/comma-separated-values" \ "http://localhost/api/v1/timeseries?node_id=dummy-node&sensor_id=dummy-sensor\ &target_id=dummy-target&response=dummy&from=2023&to=2024"
For additional meta information, add the parameter &view=1.
Read or Update Beat
On POST, adds or updates heartbeat given in Namelist format. Optionally, the payload may be deflate or zstd compressed. The API returns HTTP 201 Created if the beat was accepted.
If HTTP Basic Auth is used, the user name must match the node_id attribute of
the beat, otherwise, the request will be rejected as unauthorised (HTTP 401).
Endpoint
-
/api/v1/beat -
/api/v1/beat?node_id=<id>
HTTP Methods
-
GET
-
POST
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Node id. |
Request Headers
| Name | Values |
|---|---|
Accept |
|
| Name | Values |
|---|---|
Content-Encoding |
|
Content-Type |
|
Responses
| Status | Description |
|---|---|
|
Beat is returned. |
|
Invalid request. |
|
Unauthorised. |
|
Beat not found. |
|
Server error. |
|
Database error. |
| Status | Description |
|---|---|
|
Beat was accepted. |
|
Invalid request or payload. |
|
Unauthorised. |
|
Payload too large. |
|
Invalid payload format. |
|
Server error. |
|
Database error. |
Example
Return the heartbeat of node dummy-node in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/beat?node_id=dummy-node"
Read or Create Log
On POST, adds log in Namelist format to database. Optionally, the payload may be deflate or zstd compressed. The API returns HTTP 201 Created if the log was accepted.
If HTTP Basic Auth is used, the user name must match the node_id attribute of
the log, otherwise, the request will be rejected as unauthorised (HTTP 401).
Endpoint
-
/api/v1/log -
/api/v1/log?id=<id>
HTTP Methods
-
GET
-
POST
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Log id (UUIDv4). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
| Name | Values |
|---|---|
Content-Encoding |
|
Content-Type |
|
Responses
| Status | Description |
|---|---|
|
Log is returned. |
|
Invalid request. |
|
Unauthorised. |
|
Log not found. |
|
Server error. |
|
Database error. |
| Status | Description |
|---|---|
|
Log was accepted. |
|
Invalid request or payload. |
|
Unauthorised. |
|
Log exists in database. |
|
Payload too large. |
|
Invalid payload format. |
|
Server error. |
|
Database error. |
Example
Return a specific log in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/log?id=51adca2f1d4e42a5829fd1a378c8b6f1"
Read or Create Node
On POST, adds node in Namelist format to database. Optionally, the payload may be deflate or zstd compressed. The API returns HTTP 201 Created if the node was accepted.
If HTTP Basic Auth is used, the user name must match the node_id attribute of
the node, otherwise, the request will be rejected as unauthorised (HTTP 401).
Endpoint
-
/api/v1/node -
/api/v1/node?id=<id>
HTTP Methods
-
GET
-
POST
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Node id. |
Request Headers
| Name | Values |
|---|---|
Accept |
|
| Name | Values |
|---|---|
Content-Encoding |
|
Content-Type |
|
Responses
| Status | Description |
|---|---|
|
Node is returned. |
|
Invalid request. |
|
Unauthorised. |
|
Node not found. |
|
Server error. |
|
Database error. |
| Status | Description |
|---|---|
|
Node was accepted. |
|
Invalid request or payload. |
|
Unauthorised. |
|
Node exists in database. |
|
Payload too large. |
|
Invalid payload format. |
|
Server error. |
|
Database error. |
Example
Return node dummy-node in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/node?node_id=dummy-node"
Read or Create Observation
On POST, adds observation in Namelist format to database. Optionally, the payload may be deflate or zstd compressed. The API returns HTTP 201 Created if the observation was accepted.
If HTTP Basic Auth is used, the user name must match the node_id attribute of
the observation, otherwise, the request will be rejected as unauthorised (HTTP
401).
Endpoint
-
/api/v1/observ -
/api/v1/observ?id=<id>
HTTP Methods
-
GET
-
POST
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Observation id (UUIDv4). |
Request Headers
| Name | Values |
|---|---|
Accept |
|
| Name | Values |
|---|---|
Content-Encoding |
|
Content-Type |
|
Responses
| Status | Description |
|---|---|
|
Observation is returned. |
|
Invalid request. |
|
Unauthorised. |
|
Observation not found. |
|
Server error. |
|
Database error. |
| Status | Description |
|---|---|
|
Observation was accepted. |
|
Invalid request or payload. |
|
Unauthorised. |
|
Observation exists in database. |
|
Payload too large. |
|
Invalid payload format. |
|
Server error. |
|
Database error. |
Example
Return a specific observation in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/observ?id=7b98ae11d80b4ee392fe1a74d2c05809"
Read or Create Sensor
On POST, adds node in Namelist format to database. Optionally, the payload may be deflate or zstd compressed. The API returns HTTP 201 Created if the sensor was accepted.
If HTTP Basic Auth is used, the user name must match the node_id attribute of
the sensor, otherwise, the request will be rejected as unauthorised (HTTP 401).
Endpoint
-
/api/v1/sensor -
/api/v1/sensor?id=<id>
HTTP Methods
-
GET
-
POST
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Sensor id. |
Request Headers
| Name | Values |
|---|---|
Accept |
|
| Name | Values |
|---|---|
Content-Encoding |
|
Content-Type |
|
Responses
| Status | Description |
|---|---|
|
Sensor is returned. |
|
Invalid request. |
|
Unauthorised. |
|
Sensor not found. |
|
Server error. |
|
Database error. |
| Status | Description |
|---|---|
|
Sensor was accepted. |
|
Invalid request or payload. |
|
Unauthorised. |
|
Sensor exists in database. |
|
Payload too large. |
|
Invalid payload format. |
|
Server error. |
|
Database error. |
Example
Return sensor dummy-sensor in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/sensor?id=dummy-sensor"
Read or Create Target
On POST, adds target in Namelist format to database. Optionally, the payload may be deflate or zstd compressed. The API returns HTTP 201 Created if the target was accepted.
Endpoint
-
/api/v1/target -
/api/v1/target?id=<id>
HTTP Methods
-
GET
-
POST
Request Parameters
| GET Parameter | Type | Description |
|---|---|---|
|
string |
Target id. |
Request Headers
| Name | Values |
|---|---|
Accept |
|
| Name | Values |
|---|---|
Content-Encoding |
|
Content-Type |
|
Responses
| Status | Description |
|---|---|
|
Target is returned. |
|
Invalid request. |
|
Unauthorised. |
|
Target not found. |
|
Server error. |
|
Database error. |
| Status | Description |
|---|---|
|
Target was accepted. |
|
Invalid request or payload. |
|
Target exists in database. |
|
Payload too large. |
|
Invalid payload format. |
|
Server error. |
|
Database error. |
Example
Return target dummy-target in JSON format:
$ curl -s -u <username>:<password> --header "Accept: application/json" \ "http://localhost/api/v1/target?id=dummy-target"