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
|
|
29
|
paths:
|
30
|
/senslog15/ControllerServlet:
|
31
|
post:
|
32
|
tags:
|
33
|
- login
|
34
|
summary: Authorize login
|
35
|
operationId: login
|
36
|
parameters:
|
37
|
- in: query
|
38
|
name: username
|
39
|
schema:
|
40
|
type: string
|
41
|
description: User login
|
42
|
- in: query
|
43
|
name: password
|
44
|
schema:
|
45
|
type: string
|
46
|
description: User password
|
47
|
responses:
|
48
|
200:
|
49
|
description: successful operation
|
50
|
content:
|
51
|
application/json:
|
52
|
schema:
|
53
|
$ref: '#/components/schemas/UserCookie'
|
54
|
|
55
|
/senslog15/rest/user:
|
56
|
get:
|
57
|
tags:
|
58
|
- login
|
59
|
summary: User information
|
60
|
operationId: getUserInfo
|
61
|
responses:
|
62
|
200:
|
63
|
description: successful operation
|
64
|
content:
|
65
|
application/json:
|
66
|
schema:
|
67
|
$ref: '#/components/schemas/UserInfo'
|
68
|
|
69
|
/senslog1/GroupService:
|
70
|
get:
|
71
|
tags:
|
72
|
- group
|
73
|
summary: Get groups
|
74
|
operationId: getGroups
|
75
|
parameters:
|
76
|
- in: query
|
77
|
name: Operation
|
78
|
required: true
|
79
|
schema:
|
80
|
type: string
|
81
|
default: GetGroups
|
82
|
enum:
|
83
|
- GetGroups
|
84
|
- GetSuperGroups
|
85
|
- GetSubGroups
|
86
|
description: Group operation
|
87
|
- in: query
|
88
|
name: parent_group
|
89
|
schema:
|
90
|
type: integer
|
91
|
responses:
|
92
|
200:
|
93
|
description: successful operation
|
94
|
content:
|
95
|
application/json:
|
96
|
schema:
|
97
|
type: array
|
98
|
items:
|
99
|
$ref: '#/components/schemas/Group'
|
100
|
|
101
|
/senslog1/DataService?Operation=GetUnits:
|
102
|
get:
|
103
|
tags:
|
104
|
- data
|
105
|
summary: Get data
|
106
|
operationId: getData
|
107
|
responses:
|
108
|
200:
|
109
|
description: successful operation
|
110
|
content:
|
111
|
application/json:
|
112
|
schema:
|
113
|
type: array
|
114
|
items:
|
115
|
oneOf:
|
116
|
- type: object
|
117
|
properties:
|
118
|
drivers:
|
119
|
$ref: '#/components/schemas/Drivers'
|
120
|
generalInfo:
|
121
|
$ref: '#/components/schemas/GeneralInfo'
|
122
|
holder:
|
123
|
nullable: true
|
124
|
lastpos:
|
125
|
$ref: '#/components/schemas/Lastpos'
|
126
|
sensors:
|
127
|
type: array
|
128
|
items:
|
129
|
$ref: '#/components/schemas/Sensor'
|
130
|
unit:
|
131
|
$ref: '#/components/schemas/Unit'
|
132
|
|
133
|
/analytics/analytics:
|
134
|
get:
|
135
|
tags:
|
136
|
- analytics
|
137
|
summary: Get analytics
|
138
|
operationId: getAnalytics
|
139
|
parameters:
|
140
|
- in: query
|
141
|
name: unit_id
|
142
|
required: true
|
143
|
schema:
|
144
|
type: integer
|
145
|
- in: query
|
146
|
name: sensor_id
|
147
|
required: false
|
148
|
schema:
|
149
|
type: integer
|
150
|
- in: query
|
151
|
name: from
|
152
|
schema:
|
153
|
type: string
|
154
|
- in: query
|
155
|
name: to
|
156
|
schema:
|
157
|
type: string
|
158
|
- in: query
|
159
|
name: interval
|
160
|
schema:
|
161
|
type: string
|
162
|
responses:
|
163
|
200:
|
164
|
description: Get observation for unit
|
165
|
content:
|
166
|
application/json:
|
167
|
schema:
|
168
|
type: array
|
169
|
properties:
|
170
|
sensor:
|
171
|
$ref: '#/components/schemas/Sensors'
|
172
|
|
173
|
/senslog15/ManagementService?Operation=InsertUnit:
|
174
|
post:
|
175
|
tags:
|
176
|
- management
|
177
|
summary: Insert Unit
|
178
|
operationId: insertUnit
|
179
|
responses:
|
180
|
200:
|
181
|
description: inserted
|
182
|
requestBody:
|
183
|
required: true
|
184
|
content:
|
185
|
application/json:
|
186
|
schema:
|
187
|
type: object
|
188
|
properties:
|
189
|
unit:
|
190
|
$ref: '#/components/schemas/InsertUnit'
|
191
|
sensors:
|
192
|
type: array
|
193
|
items:
|
194
|
$ref: '#/components/schemas/InsertSensor'
|
195
|
|
196
|
/senslog15/SensorService?Operation=GetAllPhenomenons:
|
197
|
get:
|
198
|
tags:
|
199
|
- sensors
|
200
|
summary: Get phenomenons
|
201
|
operationId: getPhenomenons
|
202
|
responses:
|
203
|
200:
|
204
|
description: Getting all Phenomenons
|
205
|
content:
|
206
|
application/json:
|
207
|
schema:
|
208
|
type: array
|
209
|
items:
|
210
|
$ref: ''#/components/schemas/Phenomenon''
|
211
|
|
212
|
/senslog15/ManagementService?Operation=UpdateUnit:
|
213
|
put:
|
214
|
tags:
|
215
|
- management
|
216
|
summary: Update Unit
|
217
|
operationId: updateUnit
|
218
|
responses:
|
219
|
200:
|
220
|
description: updated
|
221
|
requestBody:
|
222
|
required: true
|
223
|
content:
|
224
|
application/json:
|
225
|
schema:
|
226
|
type: object
|
227
|
properties:
|
228
|
unit:
|
229
|
$ref: '#/components/schemas/InsertUnit'
|
230
|
|
231
|
|
232
|
components:
|
233
|
schemas:
|
234
|
InsertUnit:
|
235
|
type: object
|
236
|
properties:
|
237
|
unit_id:
|
238
|
type: integer
|
239
|
description:
|
240
|
type: string
|
241
|
|
242
|
InsertSensor:
|
243
|
type: object
|
244
|
properties:
|
245
|
sensor_id:
|
246
|
type: integer
|
247
|
sensor_name:
|
248
|
type: string
|
249
|
sensor_type:
|
250
|
type: string
|
251
|
phenomenon:
|
252
|
$ref: '#/components/schemas/InsertPhenomenon'
|
253
|
|
254
|
InsertPhenomenon:
|
255
|
type: object
|
256
|
properties:
|
257
|
phenomenon_id:
|
258
|
type: integer
|
259
|
|
260
|
UserCookie:
|
261
|
type: object
|
262
|
properties:
|
263
|
sessionid:
|
264
|
type: string
|
265
|
language:
|
266
|
type: string
|
267
|
audio:
|
268
|
type: boolean
|
269
|
rightsID:
|
270
|
type: integer
|
271
|
|
272
|
UserInfo:
|
273
|
type: object
|
274
|
properties:
|
275
|
userId:
|
276
|
type: integer
|
277
|
userName:
|
278
|
type: string
|
279
|
userPass:
|
280
|
type: string
|
281
|
userRealName:
|
282
|
type: string
|
283
|
groupId:
|
284
|
type: integer
|
285
|
"rightsId":
|
286
|
type: integer
|
287
|
|
288
|
Group:
|
289
|
type: object
|
290
|
properties:
|
291
|
id:
|
292
|
type: integer
|
293
|
parent_group_id:
|
294
|
type: integer
|
295
|
group_name:
|
296
|
type: string
|
297
|
has_children:
|
298
|
type: boolean
|
299
|
|
300
|
Unit:
|
301
|
type: object
|
302
|
properties:
|
303
|
description:
|
304
|
type: string
|
305
|
holderId:
|
306
|
type: integer
|
307
|
unitId:
|
308
|
type: integer
|
309
|
|
310
|
Phenomenon:
|
311
|
type: object
|
312
|
properties:
|
313
|
phenomenonId:
|
314
|
type: string
|
315
|
phenomenonName:
|
316
|
type: string
|
317
|
unit:
|
318
|
type: string
|
319
|
|
320
|
Sensor:
|
321
|
type: object
|
322
|
properties:
|
323
|
firstObservationTime:
|
324
|
type: string
|
325
|
format: date-time
|
326
|
lastObservationTime:
|
327
|
type: string
|
328
|
format: date-time
|
329
|
phenomenon:
|
330
|
$ref: '#/components/schemas/Phenomenon'
|
331
|
sensorId:
|
332
|
type: integer
|
333
|
sensorName:
|
334
|
type: string
|
335
|
sensorType:
|
336
|
type: string
|
337
|
|
338
|
Position:
|
339
|
type: object
|
340
|
properties:
|
341
|
SRID:
|
342
|
type: string
|
343
|
gid:
|
344
|
type: integer
|
345
|
group_id:
|
346
|
type: integer
|
347
|
postgisGeomString:
|
348
|
type: string
|
349
|
postgisString:
|
350
|
type: string
|
351
|
speed:
|
352
|
type: integer
|
353
|
time_stamp:
|
354
|
type: string
|
355
|
format: date-time
|
356
|
unit_id:
|
357
|
type: integer
|
358
|
x:
|
359
|
type: number
|
360
|
y:
|
361
|
type: number
|
362
|
|
363
|
Attributes:
|
364
|
type: object
|
365
|
properties:
|
366
|
is_online:
|
367
|
type: boolean
|
368
|
is_moving:
|
369
|
type: boolean
|
370
|
#TODO
|
371
|
AlertEvents:
|
372
|
type: array
|
373
|
|
374
|
Lastpos:
|
375
|
type: object
|
376
|
properties:
|
377
|
alertEvents:
|
378
|
$ref: '#/components/schemas/AlertEvents'
|
379
|
attributes:
|
380
|
$ref: '#/components/schemas/Attributes'
|
381
|
position:
|
382
|
$ref: '#/components/schemas/Position'
|
383
|
#TODO
|
384
|
GeneralInfo:
|
385
|
type: array
|
386
|
#TODO
|
387
|
Drivers:
|
388
|
type: array
|
389
|
|
390
|
Sensors:
|
391
|
type: object
|
392
|
properties:
|
393
|
sensorsData:
|
394
|
$ref: '#/components/schemas/SensorsData'
|
395
|
|
396
|
SensorsData:
|
397
|
type: object
|
398
|
properties:
|
399
|
interval:
|
400
|
type: number
|
401
|
data:
|
402
|
$ref: '#/components/schemas/Data'
|
403
|
statistics:
|
404
|
$ref: '#/components/schemas/Statistics'
|
405
|
|
406
|
Data:
|
407
|
type: object
|
408
|
properties:
|
409
|
observation:
|
410
|
$ref: '#/components/schemas/Observation'
|
411
|
|
412
|
Observation:
|
413
|
type: object
|
414
|
properties:
|
415
|
min:
|
416
|
type: number
|
417
|
max:
|
418
|
type: number
|
419
|
avg:
|
420
|
type: number
|
421
|
sum:
|
422
|
type: number
|
423
|
timestamp:
|
424
|
type: string
|
425
|
format: date-time
|
426
|
|
427
|
Statistics:
|
428
|
type: object
|
429
|
properties:
|
430
|
min:
|
431
|
type: number
|
432
|
max:
|
433
|
type: number
|
434
|
avg:
|
435
|
type: number
|
436
|
sum:
|
437
|
type: number
|
438
|
|
439
|
|
440
|
|
441
|
|
442
|
|
443
|
|
444
|
|