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