1
|
openapi: 3.0.1
|
2
|
info:
|
3
|
title: SensLog
|
4
|
description: 'ASWI semestral project of CodeBakers.'
|
5
|
version: 1.0.0
|
6
|
externalDocs:
|
7
|
description: Find out more about Swagger
|
8
|
url: https://swagger.io
|
9
|
|
10
|
tags:
|
11
|
- name: login
|
12
|
description: Login process
|
13
|
externalDocs:
|
14
|
description: Find out more
|
15
|
url: https://www.senslog.org/api/v1/
|
16
|
- name: group
|
17
|
description: Groups endpoints
|
18
|
- name: data
|
19
|
description: Data endpoints
|
20
|
- name: observation
|
21
|
description: Observations endpoints
|
22
|
- name: analytics
|
23
|
description: Analitics endpoints
|
24
|
- name: management
|
25
|
description: Insert endpoints
|
26
|
- name: sensors
|
27
|
description: Sensor service
|
28
|
- name: administration
|
29
|
description: Administration service
|
30
|
|
31
|
paths:
|
32
|
/senslog15/ControllerServlet:
|
33
|
post:
|
34
|
tags:
|
35
|
- login
|
36
|
summary: Authorize login
|
37
|
operationId: login
|
38
|
parameters:
|
39
|
- in: query
|
40
|
name: username
|
41
|
schema:
|
42
|
type: string
|
43
|
description: User login
|
44
|
- in: query
|
45
|
name: password
|
46
|
schema:
|
47
|
type: string
|
48
|
description: User password
|
49
|
responses:
|
50
|
200:
|
51
|
description: successful operation
|
52
|
content:
|
53
|
application/json:
|
54
|
schema:
|
55
|
$ref: '#/components/schemas/UserCookie'
|
56
|
401:
|
57
|
description: Wrong username or password
|
58
|
content:
|
59
|
text/plain:
|
60
|
schema:
|
61
|
type: string
|
62
|
|
63
|
/senslog15/rest/user:
|
64
|
get:
|
65
|
tags:
|
66
|
- login
|
67
|
summary: User information
|
68
|
operationId: getUserInfo
|
69
|
responses:
|
70
|
200:
|
71
|
description: successful operation
|
72
|
content:
|
73
|
application/json:
|
74
|
schema:
|
75
|
$ref: '#/components/schemas/UserInfo'
|
76
|
post:
|
77
|
tags:
|
78
|
- administration
|
79
|
summary: Create User
|
80
|
operationId: createUser
|
81
|
responses:
|
82
|
200:
|
83
|
description: created
|
84
|
requestBody:
|
85
|
required: true
|
86
|
content:
|
87
|
application/json:
|
88
|
schema:
|
89
|
$ref: '#/components/schemas/UserInfo'
|
90
|
|
91
|
/senslog1/SensorService?Operation=GetObservations:
|
92
|
get:
|
93
|
tags:
|
94
|
- observation
|
95
|
summary: Get observation
|
96
|
operationId: getObservation
|
97
|
parameters:
|
98
|
- in: query
|
99
|
name: unit_id
|
100
|
required: true
|
101
|
schema:
|
102
|
type: integer
|
103
|
- in: query
|
104
|
name: sensor_id
|
105
|
required: true
|
106
|
schema:
|
107
|
type: integer
|
108
|
- in: query
|
109
|
name: from
|
110
|
schema:
|
111
|
type: string
|
112
|
- in: query
|
113
|
name: to
|
114
|
schema:
|
115
|
type: string
|
116
|
responses:
|
117
|
200:
|
118
|
description: Get observation for unitId and sensorId
|
119
|
content:
|
120
|
application/json:
|
121
|
schema:
|
122
|
type: array
|
123
|
items:
|
124
|
$ref: '#/components/schemas/OldObservation'
|
125
|
500:
|
126
|
description: Internal server error
|
127
|
|
128
|
/senslog1/GroupService:
|
129
|
get:
|
130
|
tags:
|
131
|
- group
|
132
|
summary: Get groups
|
133
|
operationId: getGroups
|
134
|
parameters:
|
135
|
- in: query
|
136
|
name: Operation
|
137
|
required: true
|
138
|
schema:
|
139
|
type: string
|
140
|
default: GetGroups
|
141
|
enum:
|
142
|
- GetGroups
|
143
|
- GetSuperGroups
|
144
|
- GetSubGroups
|
145
|
description: Group operation
|
146
|
- in: query
|
147
|
name: parent_group
|
148
|
schema:
|
149
|
type: integer
|
150
|
responses:
|
151
|
200:
|
152
|
description: successful operation
|
153
|
content:
|
154
|
application/json:
|
155
|
schema:
|
156
|
type: array
|
157
|
items:
|
158
|
$ref: '#/components/schemas/Group'
|
159
|
|
160
|
/senslog1/DataService?Operation=GetUnits:
|
161
|
get:
|
162
|
tags:
|
163
|
- data
|
164
|
summary: Get data
|
165
|
operationId: getData
|
166
|
responses:
|
167
|
200:
|
168
|
description: successful operation
|
169
|
content:
|
170
|
application/json:
|
171
|
schema:
|
172
|
type: array
|
173
|
items:
|
174
|
oneOf:
|
175
|
- type: object
|
176
|
properties:
|
177
|
drivers:
|
178
|
$ref: '#/components/schemas/Drivers'
|
179
|
generalInfo:
|
180
|
$ref: '#/components/schemas/GeneralInfo'
|
181
|
holder:
|
182
|
nullable: true
|
183
|
lastpos:
|
184
|
$ref: '#/components/schemas/Lastpos'
|
185
|
sensors:
|
186
|
type: array
|
187
|
items:
|
188
|
$ref: '#/components/schemas/Sensor'
|
189
|
unit:
|
190
|
$ref: '#/components/schemas/Unit'
|
191
|
|
192
|
/analytics/analytics:
|
193
|
get:
|
194
|
tags:
|
195
|
- analytics
|
196
|
summary: Get analytics
|
197
|
operationId: getAnalytics
|
198
|
parameters:
|
199
|
- in: query
|
200
|
name: unit_id
|
201
|
required: true
|
202
|
schema:
|
203
|
type: integer
|
204
|
- in: query
|
205
|
name: sensor_id
|
206
|
required: false
|
207
|
schema:
|
208
|
type: integer
|
209
|
- in: query
|
210
|
name: from
|
211
|
schema:
|
212
|
type: string
|
213
|
- in: query
|
214
|
name: to
|
215
|
schema:
|
216
|
type: string
|
217
|
- in: query
|
218
|
name: interval
|
219
|
schema:
|
220
|
type: string
|
221
|
responses:
|
222
|
200:
|
223
|
description: Get observation for unit
|
224
|
content:
|
225
|
application/json:
|
226
|
schema:
|
227
|
type: array
|
228
|
properties:
|
229
|
sensor:
|
230
|
$ref: '#/components/schemas/Sensors'
|
231
|
400:
|
232
|
description: wrong request
|
233
|
content:
|
234
|
application/json:
|
235
|
schema:
|
236
|
type: object
|
237
|
properties:
|
238
|
message:
|
239
|
type: string
|
240
|
path:
|
241
|
type: string
|
242
|
timestamp:
|
243
|
type: number
|
244
|
|
245
|
/senslog15/ManagementService?Operation=InsertUnit:
|
246
|
post:
|
247
|
tags:
|
248
|
- management
|
249
|
summary: Insert Unit
|
250
|
operationId: insertUnit
|
251
|
responses:
|
252
|
200:
|
253
|
description: inserted
|
254
|
content:
|
255
|
application/json:
|
256
|
schema:
|
257
|
type: object
|
258
|
properties:
|
259
|
unit:
|
260
|
$ref: '#/components/schemas/InsertUnit'
|
261
|
sensors:
|
262
|
type: array
|
263
|
items:
|
264
|
$ref: '#/components/schemas/InsertSensor'
|
265
|
400:
|
266
|
description: wrong request
|
267
|
content:
|
268
|
application/json:
|
269
|
schema:
|
270
|
type: object
|
271
|
properties:
|
272
|
message:
|
273
|
type: string
|
274
|
requestBody:
|
275
|
required: true
|
276
|
content:
|
277
|
application/json:
|
278
|
schema:
|
279
|
type: object
|
280
|
properties:
|
281
|
unit:
|
282
|
$ref: '#/components/schemas/InsertUnit'
|
283
|
sensors:
|
284
|
type: array
|
285
|
items:
|
286
|
$ref: '#/components/schemas/InsertSensor'
|
287
|
|
288
|
/senslog15/ManagementService?Operation=InsertSensor:
|
289
|
post:
|
290
|
tags:
|
291
|
- management
|
292
|
summary: Insert Sensor
|
293
|
operationId: insertSensor
|
294
|
responses:
|
295
|
200:
|
296
|
description: inserted
|
297
|
content:
|
298
|
application/json:
|
299
|
schema:
|
300
|
type: object
|
301
|
properties:
|
302
|
unit:
|
303
|
$ref: '#/components/schemas/InsertUnit'
|
304
|
sensors:
|
305
|
type: array
|
306
|
items:
|
307
|
$ref: '#/components/schemas/InsertSensor'
|
308
|
400:
|
309
|
description: wrong request
|
310
|
content:
|
311
|
application/json:
|
312
|
schema:
|
313
|
type: object
|
314
|
properties:
|
315
|
message:
|
316
|
type: string
|
317
|
requestBody:
|
318
|
required: true
|
319
|
content:
|
320
|
application/json:
|
321
|
schema:
|
322
|
type: object
|
323
|
properties:
|
324
|
unit:
|
325
|
$ref: '#/components/schemas/InsertUnit'
|
326
|
sensors:
|
327
|
type: array
|
328
|
items:
|
329
|
$ref: '#/components/schemas/InsertSensor'
|
330
|
|
331
|
/senslog15/SensorService?Operation=GetAllPhenomenons:
|
332
|
get:
|
333
|
tags:
|
334
|
- sensors
|
335
|
summary: Get phenomenons
|
336
|
operationId: getPhenomenons
|
337
|
responses:
|
338
|
200:
|
339
|
description: Getting all Phenomenons
|
340
|
content:
|
341
|
application/json:
|
342
|
schema:
|
343
|
type: array
|
344
|
items:
|
345
|
$ref: '#/components/schemas/Phenomenon'
|
346
|
|
347
|
/senslog15/ManagementService?Operation=UpdateUnit:
|
348
|
put:
|
349
|
tags:
|
350
|
- management
|
351
|
summary: Update Unit
|
352
|
operationId: updateUnit
|
353
|
responses:
|
354
|
200:
|
355
|
description: updated
|
356
|
requestBody:
|
357
|
required: true
|
358
|
content:
|
359
|
application/json:
|
360
|
schema:
|
361
|
type: object
|
362
|
properties:
|
363
|
unit:
|
364
|
$ref: '#/components/schemas/InsertUnit'
|
365
|
|
366
|
/senslog15/ManagementService?Operation=DeleteUnit:
|
367
|
delete:
|
368
|
tags:
|
369
|
- management
|
370
|
summary: Delete Unit
|
371
|
operationId: deleteUnit
|
372
|
responses:
|
373
|
200:
|
374
|
description: deleted
|
375
|
content:
|
376
|
application/json:
|
377
|
schema:
|
378
|
type: object
|
379
|
properties:
|
380
|
message:
|
381
|
type: string
|
382
|
400:
|
383
|
description: wrong request
|
384
|
content:
|
385
|
application/json:
|
386
|
schema:
|
387
|
type: object
|
388
|
properties:
|
389
|
message:
|
390
|
type: string
|
391
|
requestBody:
|
392
|
required: true
|
393
|
content:
|
394
|
application/json:
|
395
|
schema:
|
396
|
type: object
|
397
|
properties:
|
398
|
unit:
|
399
|
$ref: '#/components/schemas/InsertUnit'
|
400
|
|
401
|
/senslog15/ManagementService?Operation=DeleteSensor:
|
402
|
delete:
|
403
|
tags:
|
404
|
- management
|
405
|
summary: Delete Sensor
|
406
|
operationId: deleteSensor
|
407
|
responses:
|
408
|
200:
|
409
|
description: deleted
|
410
|
content:
|
411
|
application/json:
|
412
|
schema:
|
413
|
type: object
|
414
|
properties:
|
415
|
unit:
|
416
|
$ref: '#/components/schemas/InsertUnit'
|
417
|
sensors:
|
418
|
type: array
|
419
|
items:
|
420
|
$ref: '#/components/schemas/InsertSensor'
|
421
|
400:
|
422
|
description: wrong request
|
423
|
content:
|
424
|
application/json:
|
425
|
schema:
|
426
|
type: object
|
427
|
properties:
|
428
|
message:
|
429
|
type: string
|
430
|
requestBody:
|
431
|
required: true
|
432
|
content:
|
433
|
application/json:
|
434
|
schema:
|
435
|
type: object
|
436
|
properties:
|
437
|
unit:
|
438
|
$ref: '#/components/schemas/InsertUnit'
|
439
|
sensors:
|
440
|
type: array
|
441
|
items:
|
442
|
$ref: '#/components/schemas/InsertSensor'
|
443
|
|
444
|
/senslog15/ManagementService?Operation=UpdateSensor:
|
445
|
put:
|
446
|
tags:
|
447
|
- management
|
448
|
summary: Update Sensor
|
449
|
operationId: updateSensor
|
450
|
responses:
|
451
|
200:
|
452
|
description: updated
|
453
|
content:
|
454
|
application/json:
|
455
|
schema:
|
456
|
type: object
|
457
|
properties:
|
458
|
unit:
|
459
|
$ref: '#/components/schemas/InsertUnit'
|
460
|
sensors:
|
461
|
type: array
|
462
|
items:
|
463
|
$ref: '#/components/schemas/InsertSensor'
|
464
|
400:
|
465
|
description: wrong request
|
466
|
content:
|
467
|
application/json:
|
468
|
schema:
|
469
|
type: object
|
470
|
properties:
|
471
|
message:
|
472
|
type: string
|
473
|
requestBody:
|
474
|
required: true
|
475
|
content:
|
476
|
application/json:
|
477
|
schema:
|
478
|
type: object
|
479
|
properties:
|
480
|
unit:
|
481
|
$ref: '#/components/schemas/InsertUnit'
|
482
|
sensors:
|
483
|
type: array
|
484
|
items:
|
485
|
$ref: '#/components/schemas/InsertSensor'
|
486
|
|
487
|
/senslog15/rest/user/rights:
|
488
|
get:
|
489
|
tags:
|
490
|
- administration
|
491
|
summary: Get rights
|
492
|
operationId: getRights
|
493
|
responses:
|
494
|
200:
|
495
|
description: success
|
496
|
content:
|
497
|
application/json:
|
498
|
schema:
|
499
|
type: array
|
500
|
items:
|
501
|
$ref: '#/components/schemas/Right'
|
502
|
|
503
|
|
504
|
components:
|
505
|
schemas:
|
506
|
Right:
|
507
|
type: object
|
508
|
properties:
|
509
|
rightsId:
|
510
|
type: integer
|
511
|
userRole:
|
512
|
type: string
|
513
|
note:
|
514
|
type: string
|
515
|
|
516
|
InsertUnit:
|
517
|
type: object
|
518
|
properties:
|
519
|
unit_id:
|
520
|
type: integer
|
521
|
description:
|
522
|
type: string
|
523
|
|
524
|
InsertSensor:
|
525
|
type: object
|
526
|
properties:
|
527
|
sensor_id:
|
528
|
type: integer
|
529
|
sensor_name:
|
530
|
type: string
|
531
|
sensor_type:
|
532
|
type: string
|
533
|
phenomenon:
|
534
|
$ref: '#/components/schemas/InsertPhenomenon'
|
535
|
|
536
|
InsertPhenomenon:
|
537
|
type: object
|
538
|
properties:
|
539
|
phenomenon_id:
|
540
|
type: integer
|
541
|
|
542
|
UserCookie:
|
543
|
type: object
|
544
|
properties:
|
545
|
sessionid:
|
546
|
type: string
|
547
|
language:
|
548
|
type: string
|
549
|
audio:
|
550
|
type: boolean
|
551
|
rightsID:
|
552
|
type: integer
|
553
|
|
554
|
UserInfo:
|
555
|
type: object
|
556
|
properties:
|
557
|
userId:
|
558
|
type: integer
|
559
|
userName:
|
560
|
type: string
|
561
|
userPass:
|
562
|
type: string
|
563
|
userRealName:
|
564
|
type: string
|
565
|
groupId:
|
566
|
type: integer
|
567
|
"rightsId":
|
568
|
type: integer
|
569
|
|
570
|
Group:
|
571
|
type: object
|
572
|
properties:
|
573
|
id:
|
574
|
type: integer
|
575
|
parent_group_id:
|
576
|
type: integer
|
577
|
group_name:
|
578
|
type: string
|
579
|
has_children:
|
580
|
type: boolean
|
581
|
|
582
|
Unit:
|
583
|
type: object
|
584
|
properties:
|
585
|
description:
|
586
|
type: string
|
587
|
holderId:
|
588
|
type: integer
|
589
|
unitId:
|
590
|
type: integer
|
591
|
|
592
|
Phenomenon:
|
593
|
type: object
|
594
|
properties:
|
595
|
phenomenonId:
|
596
|
type: string
|
597
|
phenomenonName:
|
598
|
type: string
|
599
|
unit:
|
600
|
type: string
|
601
|
|
602
|
Sensor:
|
603
|
type: object
|
604
|
properties:
|
605
|
firstObservationTime:
|
606
|
type: string
|
607
|
format: date-time
|
608
|
lastObservationTime:
|
609
|
type: string
|
610
|
format: date-time
|
611
|
phenomenon:
|
612
|
$ref: '#/components/schemas/Phenomenon'
|
613
|
sensorId:
|
614
|
type: integer
|
615
|
sensorName:
|
616
|
type: string
|
617
|
sensorType:
|
618
|
type: string
|
619
|
|
620
|
Position:
|
621
|
type: object
|
622
|
properties:
|
623
|
SRID:
|
624
|
type: string
|
625
|
gid:
|
626
|
type: integer
|
627
|
group_id:
|
628
|
type: integer
|
629
|
postgisGeomString:
|
630
|
type: string
|
631
|
postgisString:
|
632
|
type: string
|
633
|
speed:
|
634
|
type: integer
|
635
|
time_stamp:
|
636
|
type: string
|
637
|
format: date-time
|
638
|
unit_id:
|
639
|
type: integer
|
640
|
x:
|
641
|
type: number
|
642
|
y:
|
643
|
type: number
|
644
|
|
645
|
Attributes:
|
646
|
type: object
|
647
|
properties:
|
648
|
is_online:
|
649
|
type: boolean
|
650
|
is_moving:
|
651
|
type: boolean
|
652
|
#TODO
|
653
|
AlertEvents:
|
654
|
type: array
|
655
|
|
656
|
Lastpos:
|
657
|
type: object
|
658
|
properties:
|
659
|
alertEvents:
|
660
|
$ref: '#/components/schemas/AlertEvents'
|
661
|
attributes:
|
662
|
$ref: '#/components/schemas/Attributes'
|
663
|
position:
|
664
|
$ref: '#/components/schemas/Position'
|
665
|
#TODO
|
666
|
GeneralInfo:
|
667
|
type: array
|
668
|
#TODO
|
669
|
Drivers:
|
670
|
type: array
|
671
|
|
672
|
Sensors:
|
673
|
type: object
|
674
|
properties:
|
675
|
sensorsData:
|
676
|
$ref: '#/components/schemas/SensorsData'
|
677
|
|
678
|
SensorsData:
|
679
|
type: object
|
680
|
properties:
|
681
|
interval:
|
682
|
type: number
|
683
|
data:
|
684
|
$ref: '#/components/schemas/Data'
|
685
|
statistics:
|
686
|
$ref: '#/components/schemas/Statistics'
|
687
|
|
688
|
Data:
|
689
|
type: object
|
690
|
properties:
|
691
|
observation:
|
692
|
$ref: '#/components/schemas/Observation'
|
693
|
|
694
|
Observation:
|
695
|
type: object
|
696
|
properties:
|
697
|
min:
|
698
|
type: number
|
699
|
max:
|
700
|
type: number
|
701
|
avg:
|
702
|
type: number
|
703
|
sum:
|
704
|
type: number
|
705
|
timestamp:
|
706
|
type: string
|
707
|
format: date-time
|
708
|
|
709
|
Statistics:
|
710
|
type: object
|
711
|
properties:
|
712
|
min:
|
713
|
type: number
|
714
|
max:
|
715
|
type: number
|
716
|
avg:
|
717
|
type: number
|
718
|
sum:
|
719
|
type: number
|
720
|
|
721
|
OldObservation:
|
722
|
type: object
|
723
|
properties:
|
724
|
gid:
|
725
|
type: integer
|
726
|
time:
|
727
|
type: string
|
728
|
format: date-time
|
729
|
value:
|
730
|
type: number
|
731
|
|
732
|
|
733
|
|
734
|
|
735
|
|