Fetch latest sensor data
curl --request POST \
--url https://api.beta.ontoto.com/v1/sensor-data/latest \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{}'import requests
url = "https://api.beta.ontoto.com/v1/sensor-data/latest"
payload = {}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.beta.ontoto.com/v1/sensor-data/latest', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.beta.ontoto.com/v1/sensor-data/latest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.beta.ontoto.com/v1/sensor-data/latest"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.beta.ontoto.com/v1/sensor-data/latest")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.ontoto.com/v1/sensor-data/latest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"items": [
{
"deviceSerialNumber": "2CF44434E908",
"deviceAlias": "North mine piezometer",
"legacyDeviceId": 10042,
"sensorUuid": "b2c3d4e5-f6a7-48b9-80d1-e2f3a4b5c6d7",
"sensorAlias": "VW channel 1",
"channelIndex": 0,
"sensorStatus": "ok",
"parameterUuid": "c3d4e5f6-a7b8-49c0-91e2-f3a4b5c6d7e8",
"parameterName": "frequency_1",
"parameterAlias": "Frequency",
"parameterSourceType": "raw",
"parameterStatus": "ok",
"displayPrecision": 2,
"unit": "Hz",
"data": [
{
"timestamp": "2024-06-15T08:00:00.000Z",
"value": 2413.02
}
]
}
]
}{
"message": "Invalid request body"
}{
"message": "Authentication required"
}{
"message": "You do not have permission to access this resource"
}{
"message": "Resource not found"
}{
"message": "Duplicate entry"
}{
"message": "Rate limit of 200 requests per minute exceeded. Retry in 12s."
}{
"message": "Internal server error"
}Sensor Data
Fetch latest sensor data
Returns the most recent reading for each requested parameter.
POST
/
sensor-data
/
latest
Fetch latest sensor data
curl --request POST \
--url https://api.beta.ontoto.com/v1/sensor-data/latest \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{}'import requests
url = "https://api.beta.ontoto.com/v1/sensor-data/latest"
payload = {}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.beta.ontoto.com/v1/sensor-data/latest', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.beta.ontoto.com/v1/sensor-data/latest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.beta.ontoto.com/v1/sensor-data/latest"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.beta.ontoto.com/v1/sensor-data/latest")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.ontoto.com/v1/sensor-data/latest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"items": [
{
"deviceSerialNumber": "2CF44434E908",
"deviceAlias": "North mine piezometer",
"legacyDeviceId": 10042,
"sensorUuid": "b2c3d4e5-f6a7-48b9-80d1-e2f3a4b5c6d7",
"sensorAlias": "VW channel 1",
"channelIndex": 0,
"sensorStatus": "ok",
"parameterUuid": "c3d4e5f6-a7b8-49c0-91e2-f3a4b5c6d7e8",
"parameterName": "frequency_1",
"parameterAlias": "Frequency",
"parameterSourceType": "raw",
"parameterStatus": "ok",
"displayPrecision": 2,
"unit": "Hz",
"data": [
{
"timestamp": "2024-06-15T08:00:00.000Z",
"value": 2413.02
}
]
}
]
}{
"message": "Invalid request body"
}{
"message": "Authentication required"
}{
"message": "You do not have permission to access this resource"
}{
"message": "Resource not found"
}{
"message": "Duplicate entry"
}{
"message": "Rate limit of 200 requests per minute exceeded. Retry in 12s."
}{
"message": "Internal server error"
}Authorizations
Body
application/json
Request body for querying latest sensor data
Array of parameter UUIDs
Array of device serial numbers
Array of legacy device IDs
Required range:
-9007199254740991 <= x <= 9007199254740991Array of sensor UUIDs
Array of parameter paths to query specific data points
Show child attributes
Show child attributes
Include soft-deleted sensor data in results
Response
Successful response
Response body for querying sensor data
Show child attributes
Show child attributes