Projekt

Obecné

Profil

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