İçeriğe geç

Variable API

Variable API, inSCADA değişkenlerinin anlık ve tarihsel değerlerine REST üzerinden erişim sağlar.

Tek bir değişkenin anlık değerini okur.

Terminal window
curl -b cookies.txt http://localhost:8081/api/variables/23227/value \
-H "X-Space: claude"

Yanıt:

{
"flags": { "scaled": true },
"date": "2026-03-28T11:50:25.959+03:00",
"value": 330.48,
"extras": { "raw_value": 606.56 },
"variableShortInfo": {
"dsc": "Total active power",
"frame": "Energy-Frame",
"project": "Energy Monitoring Demo",
"device": "Energy-Device",
"name": "ActivePower_kW",
"connection": "LOCAL-Energy"
},
"dateInMs": 1774687825959
}

Birden fazla değişkenin anlık değerini toplu okur.

ParametreTipAçıklama
projectIdIntegerProje ID’si
namesStringVirgülle ayrılmış değişken adları
Terminal window
curl -b cookies.txt \
"http://localhost:8081/api/variables/values?projectId=153&names=ActivePower_kW,Voltage_V,Current_A" \
-H "X-Space: claude"

Yanıt:

{
"ActivePower_kW": {
"flags": { "scaled": true },
"date": "2026-03-28T11:50:33.950+03:00",
"value": 323.66,
"extras": { "raw_value": 606.56 },
"variableShortInfo": {
"name": "ActivePower_kW",
"dsc": "Total active power",
"project": "Energy Monitoring Demo"
},
"dateInMs": 1774687833950
},
"Voltage_V": {
"flags": { "scaled": true },
"value": 236.7,
"extras": { "raw_value": 228.0 },
"variableShortInfo": { "name": "Voltage_V", "dsc": "Line voltage" }
},
"Current_A": {
"flags": { "scaled": true },
"value": 33.12,
"extras": { "raw_value": 58.92 },
"variableShortInfo": { "name": "Current_A", "dsc": "Line current" }
}
}

Bir değişkene değer yazar.

Terminal window
curl -b cookies.txt -X POST http://localhost:8081/api/variables/23234/value \
-H "X-Space: claude" -H "Content-Type: application/json" \
-d '{"value": 55.0}'

Loglanan değişken verilerini sayfalı olarak sorgular.

ParametreTipAçıklama
projectIdIntegerProje ID’si
namesStringVirgülle ayrılmış değişken adları
startDateLongBaşlangıç zamanı (epoch ms)
endDateLongBitiş zamanı (epoch ms)
pageIntegerSayfa numarası (0’dan başlar)
sizeIntegerSayfa boyutu

Belirli aralıktaki istatistikleri döndürür.

ParametreTipAçıklama
projectIdIntegerProje ID’si
namesStringVirgülle ayrılmış değişken adları
startDateLongBaşlangıç zamanı (epoch ms)
endDateLongBitiş zamanı (epoch ms)

GET /api/variables/loggedValues/stats/hourly

Section titled “GET /api/variables/loggedValues/stats/hourly”

Saatlik gruplanmış istatistikler.

GET /api/variables/loggedValues/stats/daily

Section titled “GET /api/variables/loggedValues/stats/daily”

Günlük gruplanmış istatistikler.

MetodEndpointAçıklama
GET/api/variables?projectId=XDeğişken listesi
GET/api/variables/{id}Değişken detayı
POST/api/variablesYeni değişken oluştur
PUT/api/variables/{id}Değişken güncelle
DELETE/api/variables/{id}Değişken sil
Terminal window
curl -b cookies.txt "http://localhost:8081/api/variables?projectId=153" \
-H "X-Space: claude"

Yanıt (kısaltılmış):

[
{
"id": 23227,
"name": "ActivePower_kW",
"dsc": "Total active power",
"type": "Float",
"unit": "kW",
"projectId": 153,
"connectionId": 153,
"deviceId": 453,
"frameId": 703,
"logType": "Periodically",
"logPeriod": 10,
"engZeroScale": 0.0,
"engFullScale": 1000.0,
"fractionalDigitCount": 2,
"isActive": true,
"keepLastValues": true
},
{
"id": 23229,
"name": "Voltage_V",
"dsc": "Line voltage",
"type": "Float",
"unit": "V",
"engZeroScale": 200.0,
"engFullScale": 260.0
}
]