The /loggers/* endpoints expose historical and live timeseries data over HTTP. They are the most heavily used part of the REST API — the Weble Cloud queries them to feed dashboards, sync site metadata, and forward write operations to remote gateways.
All endpoints described here require an authenticated session — see authentication.
GET /loggers/sitesReturn the list of sites known to the gateway. A site is one logical data source, identified by a unique id (typically the gateway's hardware address for the local box, or a remote box id when accessed through a log connector).
Query parameters:
| Param | Description |
|---|---|
connector |
Optional. Restrict the result to one or more logger connectors (string or array) |
group |
Optional. Restrict to connectors belonging to one or more groups |
detailed |
Optional. 1 to include name and metadata for each site, 0 (default) to return only ids |
connector and group are read from the query string only.
Response (detailed=1):
[
{ "id" : "ab_cd_ef_01_02_03", "local" : true, "name" : "box_local_addresses" },
{ "id" : "site_remote_42", "name" : "Boiler room — Geneva" }
]
Example:
curl -b cookies.txt 'https://gateway.example.com/loggers/sites?detailed=1'
GET /loggers/dataThe main historical query endpoint. Returns timeseries values for one or more addresses, optionally aggregated.
Request body / query parameters:
| Field | Type | Description |
|---|---|---|
address |
string / array | One or more address keys to query |
start |
ISO date / millis | Start of the time window |
end |
ISO date / millis | End of the time window |
aggregate |
string | Optional. Aggregation interval — see units below. When set, returns one row per bucket with value_avg, value_min, value_max, value_first, value_last, value_count. all gives one bucket for the whole window. |
streaming |
true / 1 |
Required. The response is a text stream, one JSON row per line. |
timezone |
string | Optional. IANA time zone (e.g. UTC, Europe/Paris) in which the aggregation buckets are calculated. Default: the time zone of the device. An error is returned if the logger does not support it. |
site |
string | Optional. Site id (see /loggers/sites) applied to every address that has no site prefix |
limit |
number | Optional. Maximum number of rows |
anchor |
string | Optional. left (default) or center: where ts sits in the bucket |
connector and group have no effect on /loggers/data: each address is sent to the logger connector of its site. All the other fields can be sent in the JSON body or as query parameters (?address=4/7/25&address=4/7/26&start=2026-04-07T00:00:00Z&end=2026-04-08T00:00:00Z&aggregate=15m&streaming=1), which helps with HTTP clients that cannot send a body with GET.
Address keys. A key can name its site: <site>¬<address> or <site>¬<gateway>¬<address> (| is accepted instead of the first ¬). A key without a known site is read on the local box.
Aggregation units for aggregate:
| Suffix | Unit | Example |
|---|---|---|
s |
seconds | 30s |
m |
minutes | 15m |
h |
hours | 1h |
d |
days | 1d |
w |
weeks | 1w |
o |
months | 1o |
y |
years | 1y |
An offset can shift the buckets: 1d+6h gives days from 06:00 to 06:00 local time. Other examples: 1w-2h, 1d+330m. The offset unit is m or h.
Row format, raw values (no aggregate):
{ "address" : "local¬4/7/25", "ts" : 1775655000000, "value" : 21.5, "value_string" : "21.5" }
With aggregate, one row per bucket:
{ "address" : "local¬4/7/25", "ts" : 1775655000000, "start" : 1775655000000, "end" : 1775655900000,
"value_avg" : 21.5, "value_min" : 20.8, "value_max" : 22.1,
"value_first" : 20.9, "value_last" : 21.7, "value_count" : 90 }
ts is a Unix time in milliseconds.address repeats the key you asked for, prefixed with its site and ¬. An address asked without a site is answered as local¬<address>.value_var, the variance of the bucket): ignore the ones you do not use.Streaming response:
When streaming=true, the response is a text/plain body where each line is a complete JSON object representing one row, terminated by \r\n. The stream ends when the response closes. On error, the last line is {"error":"..."}.
Example — last 24 hours, 15-minute buckets, streamed:
curl -X GET -b cookies.txt 'https://gateway.example.com/loggers/data' \
-H 'Content-Type: application/json' \
-d '{
"address" : ["4/7/25", "4/7/26"],
"start" : "2026-04-07T00:00:00Z",
"end" : "2026-04-08T00:00:00Z",
"aggregate" : "15m",
"streaming" : true
}'
GET /loggers/siteDataReturns the definition of a site as one JSON document. Used by the cloud to sync site state in one round trip.
{ "gateways" : [ { "id" : 3, "name" : "…", "driver" : "modbus", "json" : { … } }, … ],
"addresses" : [ { "id" : 23055, "name" : "4/7/25", "gateway_id" : 3, "alias" : "…", "description" : "…", "log" : …, "json" : { … } }, … ],
"hash" : "9f1c…" }
It contains the configuration of the gateways and addresses, not their values (use /loggers/live or gateways.getLastValue for values).
Body:
{
"site" : "site_remote_42",
"hash" : "<optional cached hash>"
}
Keep hash and send it back on the next call: while nothing has been added, changed or deleted, the answer is 304 Not Modified with an empty body. Otherwise the new document is sent. This makes it cheap to poll for changes. Errors (missing site, site connector not found) are plain text with status 402.
GET /loggers/liveSubscribe to live value updates. The endpoint holds the connection open and writes one NDJSON line per new value received from the field bus.
Body:
| Field | Description |
|---|---|
address |
One or more address keys to watch (string or array) |
id |
Optional. Watcher id — pass the same id again to resume an existing subscription instead of creating a new one |
Response stream:
{"id":"local¬4/7/25","value":21.5,"value_string":"21.5°C","value_date":"2026-04-08T13:42:01.000Z"}
{"id":"local¬4/7/26","value":21.7,"value_string":"21.7°C","value_date":"2026-04-08T13:42:01.000Z"}
{"status":"alive"}
{"id":"local¬4/7/25","value":21.6,"value_string":"21.6°C","value_date":"2026-04-08T13:42:11.000Z"}
Each line is {"id": "<site>¬<address>", "value": …, "value_string": …, "value_date": …}; an address requested without a site is reported as local¬<address>. The first lines give the current value of each address; an unknown address gives {"id": …, "error": …}. The response is sent with Content-Type: text/event-stream, but the body is plain NDJSON, not Server-Sent Events.
A {"status":"alive"} keepalive line is emitted every second when there is no traffic, so clients can detect a dead connection.
Reconnecting with the same id: the new request takes over the subscription; the previous connection receives a last line handled (plain text, not JSON) and is closed. Values that changed while no connection was open are lost, and current values are not sent again: read them with gateways.getLastValue after a reconnection if you need them. Without a new connection, the subscription is deleted 60 seconds after the client disconnects.
Example — Node.js consumer:
var https = require('https')
var req = https.request({
method : 'GET',
host : 'gateway.example.com',
path : '/loggers/live',
headers : { 'Cookie' : 'WBLSUPSID=...', 'Content-Type' : 'application/json' }
}, function(res){
var buf = ''
res.on('data', function(chunk){
buf += chunk
var lines = buf.split('\r\n')
buf = lines.pop()
lines.forEach(function(line){
if(!line) return
if(line === 'handled') return // subscription taken over by another request
var update = JSON.parse(line)
if(update.status) return // keepalive
console.log(update.id, '=', update.value)
})
})
})
req.write(JSON.stringify({ address : ['4/7/25', '4/7/26'] }))
req.end()
POST /loggers/functionExecute a server-side function on a site. This is the only REST endpoint that lets you write back to the gateway through the loggers layer — typically used by the cloud to push value writes or address metadata updates to a remote box.
Body:
| Field | Description |
|---|---|
site |
Site id to target |
name |
Function name (whitelisted, see below) |
value |
Function-specific payload |
Whitelisted functions:
name |
Description | value shape |
|---|---|---|
write |
Write a decoded value to an address. Equivalent to gateways.writeValue |
{ "address" : "4/7/25", "value" : 1 } |
updateaddresslog |
Update address logging metadata in bulk. Used by the cloud after editing log settings remotely | [{ "id" : 23055, "log" : { ... } }, ...] |
Any other name is rejected with 400. Success answers { "ok" : true }; errors are { "error" : "…" } with status 400, 403 or 500.
Example — write a value:
curl -b cookies.txt -X POST 'https://gateway.example.com/loggers/function' \
-H 'Content-Type: application/json' \
-d '{
"site" : "ab_cd_ef_01_02_03",
"name" : "write",
"value" : { "address" : "4/7/25", "value" : 1 }
}'
GET /loggers/status answers 200 with an empty body: a cheap check that the session is valid.
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
WEEK_AGO=$(date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ)
curl -X GET -b cookies.txt 'https://gateway.example.com/loggers/data' \
-H 'Content-Type: application/json' \
-d "{
\"address\" : [\"%M1\", \"%M2\"],
\"start\" : \"$WEEK_AGO\",
\"end\" : \"$NOW\",
\"aggregate\" : \"1h\",
\"streaming\" : true
}"
curl -X GET -b cookies.txt -N 'https://gateway.example.com/loggers/live' \
-H 'Content-Type: application/json' \
-d '{"address":["tempLiving","tempBedroom"]}' \
| grep -v '"alive"' >> /var/log/weble-tail.log
HASH=$(cat .last_site_hash 2>/dev/null || echo '')
CODE=$(curl -X GET -b cookies.txt -s -o site.json -w '%{http_code}' \
'https://gateway.example.com/loggers/siteData' \
-H 'Content-Type: application/json' \
-d "{\"site\":\"local\",\"hash\":\"$HASH\"}")
if [ "$CODE" = "304" ]; then
echo 'unchanged'
else
python3 -c 'import json,sys; print(json.load(sys.stdin)["hash"])' < site.json > .last_site_hash
echo 'updated'
fi