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
|
|
57
|
/senslog15/rest/user:
|
58
|
get:
|
59
|
tags:
|
60
|
- login
|
61
|
summary: User information
|
62
|
operationId: getUserInfo
|
63
|
responses:
|
64
|
200:
|
65
|
description: successful operation
|
66
|
content:
|
67
|
application/json:
|
68
|
schema:
|
69
|
$ref: '#/components/schemas/UserInfo'
|
70
|
post:
|
71
|
tags:
|
72
|
- administration
|
73
|
summary: Create User
|
74
|
operationId: createUser
|
75
|
responses:
|
76
|
200:
|
77
|
description: created
|
78
|
requestBody:
|
79
|
required: true
|
80
|
content:
|
81
|
application/json:
|
82
|
schema:
|
83
|
$ref: '#/components/schemas/UserInfo'
|
84
|
|
85
|
/senslog1/SensorService?Operation=GetObservations:
|
86
|
get:
|
87
|
tags:
|
88
|
- observation
|
89
|
summary: Get observation
|
90
|
operationId: getObservation
|
91
|
parameters:
|
92
|
- in: query
|
93
|
name: unit_id
|
94
|
required: true
|
95
|
schema:
|
96
|
type: integer
|
97
|
- in: query
|
98
|
name: sensor_id
|
99
|
required: true
|
100
|
schema:
|
101
|
type: integer
|
102
|
- in: query
|
103
|
name: from
|
104
|
schema:
|
105
|
type: string
|
106
|
- in: query
|
107
|
name: to
|
108
|
schema:
|
109
|
type: string
|
110
|
responses:
|
111
|
200:
|
112
|
description: Get observation for unitId and sensorId
|
113
|
content:
|
114
|
application/json:
|
115
|
schema:
|
116
|
type: array
|
117
|
items:
|
118
|
$ref: '#/components/schemas/OldObservation'
|
119
|
|
120
|
/senslog1/GroupService:
|
121
|
get:
|
122
|
tags:
|
123
|
- group
|
124
|
summary: Get groups
|
125
|
operationId: getGroups
|
126
|
parameters:
|
127
|
- in: query
|
128
|
name: Operation
|
129
|
required: true
|
130
|
schema:
|
131
|
type: string
|
132
|
default: GetGroups
|
133
|
enum:
|
134
|
- GetGroups
|
135
|
- GetSuperGroups
|
136
|
- GetSubGroups
|
137
|
description: Group operation
|
138
|
- in: query
|
139
|
name: parent_group
|
140
|
schema:
|
141
|
type: integer
|
142
|
responses:
|
143
|
200:
|
144
|
description: successful operation
|
145
|
content:
|
146
|
application/json:
|
147
|
schema:
|
148
|
type: array
|
149
|
items:
|
150
|
$ref: '#/components/schemas/Group'
|
151
|
|
152
|
/senslog1/DataService?Operation=GetUnits:
|
153
|
get:
|
154
|
tags:
|
155
|
- data
|
156
|
summary: Get data
|
157
|
operationId: getData
|
158
|
responses:
|
159
|
200:
|
160
|
description: successful operation
|
161
|
content:
|
162
|
application/json:
|
163
|
schema:
|
164
|
type: array
|
165
|
items:
|
166
|
oneOf:
|
167
|
- type: object
|
168
|
properties:
|
169
|
drivers:
|
170
|
$ref: '#/components/schemas/Drivers'
|
171
|
generalInfo:
|
172
|
$ref: '#/components/schemas/GeneralInfo'
|
173
|
holder:
|
174
|
nullable: true
|
175
|
lastpos:
|
176
|
$ref: '#/components/schemas/Lastpos'
|
177
|
sensors:
|
178
|
type: array
|
179
|
items:
|
180
|
$ref: '#/components/schemas/Sensor'
|
181
|
unit:
|
182
|
$ref: '#/components/schemas/Unit'
|
183
|
|
184
|
/analytics/analytics:
|
185
|
get:
|
186
|
tags:
|
187
|
- analytics
|
188
|
summary: Get analytics
|
189
|
operationId: getAnalytics
|
190
|
parameters:
|
191
|
- in: query
|
192
|
name: unit_id
|
193
|
required: true
|
194
|
schema:
|
195
|
type: integer
|
196
|
- in: query
|
197
|
name: sensor_id
|
198
|
required: false
|
199
|
schema:
|
200
|
type: integer
|
201
|
- in: query
|
202
|
name: from
|
203
|
schema:
|
204
|
type: string
|
205
|
- in: query
|
206
|
name: to
|
207
|
schema:
|
208
|
type: string
|
209
|
- in: query
|
210
|
name: interval
|
211
|
schema:
|
212
|
type: string
|
213
|
responses:
|
214
|
200:
|
215
|
description: Get observation for unit
|
216
|
content:
|
217
|
application/json:
|
218
|
schema:
|
219
|
type: array
|
220
|
properties:
|
221
|
sensor:
|
222
|
$ref: '#/components/schemas/Sensors'
|
223
|
|
224
|
/senslog15/ManagementService?Operation=InsertUnit:
|
225
|
post:
|
226
|
tags:
|
227
|
- management
|
228
|
summary: Insert Unit
|
229
|
operationId: insertUnit
|
230
|
responses:
|
231
|
200:
|
232
|
description: inserted
|
233
|
requestBody:
|
234
|
required: true
|
235
|
content:
|
236
|
application/json:
|
237
|
schema:
|
238
|
type: object
|
239
|
properties:
|
240
|
unit:
|
241
|
$ref: '#/components/schemas/InsertUnit'
|
242
|
sensors:
|
243
|
type: array
|
244
|
items:
|
245
|
$ref: '#/components/schemas/InsertSensor'
|
246
|
|
247
|
/senslog15/SensorService?Operation=GetAllPhenomenons:
|
248
|
get:
|
249
|
tags:
|
250
|
- sensors
|
251
|
summary: Get phenomenons
|
252
|
operationId: getPhenomenons
|
253
|
responses:
|
254
|
200:
|
255
|
description: Getting all Phenomenons
|
256
|
content:
|
257
|
application/json:
|
258
|
schema:
|
259
|
type: array
|
260
|
items:
|
261
|
$ref: ''#/components/schemas/Phenomenon''
|
262
|
|
263
|
/senslog15/ManagementService?Operation=UpdateUnit:
|
264
|
put:
|
265
|
tags:
|
266
|
- management
|
267
|
summary: Update Unit
|
268
|
operationId: updateUnit
|
269
|
responses:
|
270
|
200:
|
271
|
description: updated
|
272
|
requestBody:
|
273
|
required: true
|
274
|
content:
|
275
|
application/json:
|
276
|
schema:
|
277
|
type: object
|
278
|
properties:
|
279
|
unit:
|
280
|
$ref: '#/components/schemas/InsertUnit'
|
281
|
|
282
|
/senslog15/ManagementService?Operation=DeleteUnit:
|
283
|
delete:
|
284
|
tags:
|
285
|
- management
|
286
|
summary: Delete Unit
|
287
|
operationId: deleteUnit
|
288
|
responses:
|
289
|
200:
|
290
|
description: deleted
|
291
|
content:
|
292
|
application/json:
|
293
|
schema:
|
294
|
type: object
|
295
|
properties:
|
296
|
message:
|
297
|
type: string
|
298
|
requestBody:
|
299
|
required: true
|
300
|
content:
|
301
|
application/json:
|
302
|
schema:
|
303
|
type: object
|
304
|
properties:
|
305
|
unit:
|
306
|
$ref: '#/components/schemas/InsertUnit'
|
307
|
|
308
|
/senslog15/ManagementService?Operation=DeleteSensor:
|
309
|
delete:
|
310
|
tags:
|
311
|
- management
|
312
|
summary: Delete Sensor
|
313
|
operationId: deleteSensor
|
314
|
responses:
|
315
|
200:
|
316
|
description: deleted
|
317
|
content:
|
318
|
application/json:
|
319
|
schema:
|
320
|
type: object
|
321
|
properties:
|
322
|
message:
|
323
|
type: string
|
324
|
requestBody:
|
325
|
required: true
|
326
|
content:
|
327
|
application/json:
|
328
|
schema:
|
329
|
type: object
|
330
|
properties:
|
331
|
unit:
|
332
|
$ref: '#/components/schemas/InsertUnit'
|
333
|
sensors:
|
334
|
type: array
|
335
|
items:
|
336
|
$ref: '#/components/schemas/InsertSensor'
|
337
|
|
338
|
/senslog15/ManagementService?Operation=UpdateSensor:
|
339
|
put:
|
340
|
tags:
|
341
|
- management
|
342
|
summary: Update Sensor
|
343
|
operationId: updateSensor
|
344
|
responses:
|
345
|
200:
|
346
|
description: updated
|
347
|
requestBody:
|
348
|
required: true
|
349
|
content:
|
350
|
application/json:
|
351
|
schema:
|
352
|
type: object
|
353
|
properties:
|
354
|
unit:
|
355
|
$ref: '#/components/schemas/InsertUnit'
|
356
|
sensors:
|
357
|
type: array
|
358
|
items:
|
359
|
$ref: '#/components/schemas/InsertSensor'
|
360
|
|
361
|
/senslog15/rest/user/rights:
|
362
|
get:
|
363
|
tags:
|
364
|
- administration
|
365
|
summary: Get rights
|
366
|
operationId: getRights
|
367
|
responses:
|
368
|
200:
|
369
|
description: success
|
370
|
content:
|
371
|
application/json:
|
372
|
schema:
|
373
|
type: array
|
374
|
items:
|
375
|
$ref: '#/components/schemas/Right'
|
376
|
|
377
|
|
378
|
components:
|
379
|
schemas:
|
380
|
Right:
|
381
|
type: object
|
382
|
properties:
|
383
|
rightsId:
|
384
|
type: integer
|
385
|
userRole:
|
386
|
type: string
|
387
|
note:
|
388
|
type: string
|
389
|
|
390
|
InsertUnit:
|
391
|
type: object
|
392
|
properties:
|
393
|
unit_id:
|
394
|
type: integer
|
395
|
description:
|
396
|
type: string
|
397
|
|
398
|
InsertSensor:
|
399
|
type: object
|
400
|
properties:
|
401
|
sensor_id:
|
402
|
type: integer
|
403
|
sensor_name:
|
404
|
type: string
|
405
|
sensor_type:
|
406
|
type: string
|
407
|
phenomenon:
|
408
|
$ref: '#/components/schemas/InsertPhenomenon'
|
409
|
|
410
|
InsertPhenomenon:
|
411
|
type: object
|
412
|
properties:
|
413
|
phenomenon_id:
|
414
|
type: integer
|
415
|
|
416
|
UserCookie:
|
417
|
type: object
|
418
|
properties:
|
419
|
sessionid:
|
420
|
type: string
|
421
|
language:
|
422
|
type: string
|
423
|
audio:
|
424
|
type: boolean
|
425
|
rightsID:
|
426
|
type: integer
|
427
|
|
428
|
UserInfo:
|
429
|
type: object
|
430
|
properties:
|
431
|
userId:
|
432
|
type: integer
|
433
|
userName:
|
434
|
type: string
|
435
|
userPass:
|
436
|
type: string
|
437
|
userRealName:
|
438
|
type: string
|
439
|
groupId:
|
440
|
type: integer
|
441
|
"rightsId":
|
442
|
type: integer
|
443
|
|
444
|
Group:
|
445
|
type: object
|
446
|
properties:
|
447
|
id:
|
448
|
type: integer
|
449
|
parent_group_id:
|
450
|
type: integer
|
451
|
group_name:
|
452
|
type: string
|
453
|
has_children:
|
454
|
type: boolean
|
455
|
|
456
|
Unit:
|
457
|
type: object
|
458
|
properties:
|
459
|
description:
|
460
|
type: string
|
461
|
holderId:
|
462
|
type: integer
|
463
|
unitId:
|
464
|
type: integer
|
465
|
|
466
|
Phenomenon:
|
467
|
type: object
|
468
|
properties:
|
469
|
phenomenonId:
|
470
|
type: string
|
471
|
phenomenonName:
|
472
|
type: string
|
473
|
unit:
|
474
|
type: string
|
475
|
|
476
|
Sensor:
|
477
|
type: object
|
478
|
properties:
|
479
|
firstObservationTime:
|
480
|
type: string
|
481
|
format: date-time
|
482
|
lastObservationTime:
|
483
|
type: string
|
484
|
format: date-time
|
485
|
phenomenon:
|
486
|
$ref: '#/components/schemas/Phenomenon'
|
487
|
sensorId:
|
488
|
type: integer
|
489
|
sensorName:
|
490
|
type: string
|
491
|
sensorType:
|
492
|
type: string
|
493
|
|
494
|
Position:
|
495
|
type: object
|
496
|
properties:
|
497
|
SRID:
|
498
|
type: string
|
499
|
gid:
|
500
|
type: integer
|
501
|
group_id:
|
502
|
type: integer
|
503
|
postgisGeomString:
|
504
|
type: string
|
505
|
postgisString:
|
506
|
type: string
|
507
|
speed:
|
508
|
type: integer
|
509
|
time_stamp:
|
510
|
type: string
|
511
|
format: date-time
|
512
|
unit_id:
|
513
|
type: integer
|
514
|
x:
|
515
|
type: number
|
516
|
y:
|
517
|
type: number
|
518
|
|
519
|
Attributes:
|
520
|
type: object
|
521
|
properties:
|
522
|
is_online:
|
523
|
type: boolean
|
524
|
is_moving:
|
525
|
type: boolean
|
526
|
#TODO
|
527
|
AlertEvents:
|
528
|
type: array
|
529
|
|
530
|
Lastpos:
|
531
|
type: object
|
532
|
properties:
|
533
|
alertEvents:
|
534
|
$ref: '#/components/schemas/AlertEvents'
|
535
|
attributes:
|
536
|
$ref: '#/components/schemas/Attributes'
|
537
|
position:
|
538
|
$ref: '#/components/schemas/Position'
|
539
|
#TODO
|
540
|
GeneralInfo:
|
541
|
type: array
|
542
|
#TODO
|
543
|
Drivers:
|
544
|
type: array
|
545
|
|
546
|
Sensors:
|
547
|
type: object
|
548
|
properties:
|
549
|
sensorsData:
|
550
|
$ref: '#/components/schemas/SensorsData'
|
551
|
|
552
|
SensorsData:
|
553
|
type: object
|
554
|
properties:
|
555
|
interval:
|
556
|
type: number
|
557
|
data:
|
558
|
$ref: '#/components/schemas/Data'
|
559
|
statistics:
|
560
|
$ref: '#/components/schemas/Statistics'
|
561
|
|
562
|
Data:
|
563
|
type: object
|
564
|
properties:
|
565
|
observation:
|
566
|
$ref: '#/components/schemas/Observation'
|
567
|
|
568
|
Observation:
|
569
|
type: object
|
570
|
properties:
|
571
|
min:
|
572
|
type: number
|
573
|
max:
|
574
|
type: number
|
575
|
avg:
|
576
|
type: number
|
577
|
sum:
|
578
|
type: number
|
579
|
timestamp:
|
580
|
type: string
|
581
|
format: date-time
|
582
|
|
583
|
Statistics:
|
584
|
type: object
|
585
|
properties:
|
586
|
min:
|
587
|
type: number
|
588
|
max:
|
589
|
type: number
|
590
|
avg:
|
591
|
type: number
|
592
|
sum:
|
593
|
type: number
|
594
|
|
595
|
OldObservation:
|
596
|
type: object
|
597
|
properties:
|
598
|
gid:
|
599
|
type: integer
|
600
|
time:
|
601
|
type: string
|
602
|
format: date-time
|
603
|
value:
|
604
|
type: number
|
605
|
|
606
|
|
607
|
|
608
|
|
609
|
|