-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayground.http
More file actions
70 lines (63 loc) · 2.01 KB
/
playground.http
File metadata and controls
70 lines (63 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Variabel untuk memudahkan penggantian alamat host
@hostname = http://localhost:3000
@api_version = /api/v1
###
# 1. MENGIRIM DATA SENSOR (INGEST)
# Mengirimkan sebuah batch berisi 5 data sensor.
# Perhatikan bahwa data terakhir untuk 'device-001' memiliki suhu yang
# sangat tinggi (anomali) untuk tujuan pengujian.
POST {{hostname}}{{api_version}}/readings
Content-Type: application/json
[
{
"device_id": "device-001",
"timestamp": "2025-09-17T13:10:00.000Z",
"temperature": 25.5,
"humidity": 60.1
},
{
"device_id": "device-002",
"timestamp": "2025-09-17T13:10:05.000Z",
"temperature": 22.1,
"humidity": 55.8
},
{
"device_id": "device-001",
"timestamp": "2025-09-17T13:11:00.000Z",
"temperature": 25.8,
"humidity": 60.3
},
{
"device_id": "device-002",
"timestamp": "2025-09-17T13:11:05.000Z",
"temperature": 22.3,
"humidity": 55.9
},
{
"device_id": "device-001",
"timestamp": "2025-09-17T13:12:00.000Z",
"temperature": 75.0,
"humidity": 60.5
}
]
###
# 2. MENDAPATKAN RINGKASAN DATA PER JAM
# Mengambil data agregat (rata-rata suhu, kelembaban, jumlah data)
# untuk 'device-001' dalam rentang waktu tertentu.
# Anda bisa mengubah deviceID di URL dan parameter 'from'/'to'.
GET {{hostname}}{{api_version}}/summary/device-001?from=2025-09-17T00:00:00Z&to=2025-09-18T23:59:59Z
Accept: application/json
###
# 3. MENCARI DATA ANOMALI SUHU
# Mencari data di seluruh perangkat di mana suhu menyimpang lebih dari
# 10 derajat dari rata-rata suhu perangkat tersebut.
# Seharusnya request ini akan menemukan data suhu 75.0 yang kita kirim sebelumnya.
GET {{hostname}}{{api_version}}/anomalies?threshold=10
Accept: application/json
###
# 4. MENCARI DATA ANOMALI (THRESHOLD LEBIH TINGGI)
# Contoh yang sama seperti di atas, tetapi dengan threshold yang sangat tinggi.
# Request ini kemungkinan besar tidak akan mengembalikan hasil apa pun,
# menunjukkan bahwa filternya berfungsi.
GET {{hostname}}{{api_version}}/anomalies?threshold=50
Accept: application/json