Projekt

Obecné

Profil

Stáhnout (19.1 KB) Statistiky
| Větev: | Tag: | Revize:
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
  /senslog15/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
  /senslog15/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
        500:
149
          description: Internal server error
150

    
151
  /senslog15/GroupService:
152
    get:
153
      tags:
154
      - group
155
      summary: Get groups
156
      operationId: getGroups
157
      parameters:
158
        - in: query
159
          name: Operation
160
          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

    
183
  /senslog15/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
  /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
        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

    
268
  /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
          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
      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
                  $ref: '#/components/schemas/Phenomenon'
369

    
370
  /senslog15/SensorService?Operation=GetAllSensorTypes:
371
    get:
372
      tags:
373
        - sensors
374
      summary: Get sensor types
375
      operationId: getSensorTypes
376
      responses:
377
        200:
378
          description: Getting all Sensor types
379
          content:
380
            application/json:
381
              schema:
382
                type: array
383
                items:
384
                  $ref: '#/components/schemas/SensorType'
385

    
386
  /senslog15/ManagementService?Operation=UpdateUnit:
387
    put:
388
      tags:
389
        - management
390
      summary: Update Unit
391
      operationId: updateUnit
392
      responses:
393
        200:
394
          description: updated
395
      requestBody:
396
        required: true
397
        content:
398
          application/json:
399
            schema:
400
              type: object
401
              properties:
402
                unit:
403
                  $ref: '#/components/schemas/InsertUnit'
404

    
405
  /senslog15/ManagementService?Operation=DeleteUnit:
406
    delete:
407
      tags:
408
        - management
409
      summary: Delete Unit
410
      operationId: deleteUnit
411
      responses:
412
        200:
413
          description: deleted
414
          content:
415
            application/json:
416
              schema:
417
                type: object
418
                properties:
419
                  message:
420
                    type: string
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

    
440
  /senslog15/ManagementService?Operation=DeleteSensor:
441
    delete:
442
      tags:
443
        - management
444
      summary: Delete Sensor
445
      operationId: deleteSensor
446
      responses:
447
        200:
448
          description: deleted
449
          content:
450
            application/json:
451
              schema:
452
                type: object
453
                properties:
454
                  unit:
455
                    $ref: '#/components/schemas/InsertUnit'
456
                  sensors:
457
                    type: array
458
                    items:
459
                      $ref: '#/components/schemas/InsertSensor'
460
        400:
461
          description: wrong request
462
          content:
463
            application/json:
464
              schema:
465
                type: object
466
                properties:
467
                  message:
468
                    type: string
469
      requestBody:
470
        required: true
471
        content:
472
          application/json:
473
            schema:
474
              type: object
475
              properties:
476
                unit:
477
                  $ref: '#/components/schemas/InsertUnit'
478
                sensors:
479
                  type: array
480
                  items:
481
                    $ref: '#/components/schemas/InsertSensor'
482

    
483
  /senslog15/ManagementService?Operation=UpdateSensor:
484
    put:
485
      tags:
486
        - management
487
      summary: Update Sensor
488
      operationId: updateSensor
489
      responses:
490
        200:
491
          description: updated
492
          content:
493
            application/json:
494
              schema:
495
                type: object
496
                properties:
497
                  unit:
498
                    $ref: '#/components/schemas/InsertUnit'
499
                  sensors:
500
                    type: array
501
                    items:
502
                      $ref: '#/components/schemas/InsertSensor'
503
        400:
504
          description: wrong request
505
          content:
506
            application/json:
507
              schema:
508
                type: object
509
                properties:
510
                  message:
511
                    type: string
512
      requestBody:
513
        required: true
514
        content:
515
          application/json:
516
            schema:
517
              type: object
518
              properties:
519
                unit:
520
                  $ref: '#/components/schemas/InsertUnit'
521
                sensors:
522
                  type: array
523
                  items:
524
                    $ref: '#/components/schemas/InsertSensor'
525

    
526
  /senslog15/rest/user/rights:
527
    get:
528
      tags:
529
        - administration
530
      summary: Get rights
531
      operationId: getRights
532
      responses:
533
        200:
534
          description: success
535
          content:
536
            application/json:
537
              schema:
538
                type: array
539
                items:
540
                  $ref: '#/components/schemas/Right'
541

    
542
  /senslog15/FeederServlet?Operation=InsertPosition:
543
    get:
544
      tags:
545
        - sensors
546
      parameters:
547
        - in: query
548
          name: lat
549
          required: true
550
          schema:
551
            type: number
552
        - in: query
553
          name: lon
554
          required: true
555
          schema:
556
            type: number
557
        - in: query
558
          name: unit_id
559
          required: true
560
          schema:
561
            type: integer
562
        - in: query
563
          name: date
564
          required: true
565
          schema:
566
            type: string
567
        - in: query
568
          name: alt
569
          required: false
570
          schema:
571
            type: string
572
        - in: query
573
          name: speed
574
          required: false
575
          schema:
576
            type: number
577
        - in: query
578
          name: dop
579
          required: false
580
          schema:
581
            type: number
582
      summary: Insert position to unit
583
      operationId: insertPosition
584
      responses:
585
        200:
586
          description: success
587

    
588
components:
589
  schemas:
590
    Right:
591
      type: object
592
      properties:
593
        rightsId:
594
          type: integer
595
        userRole:
596
          type: string
597
        note:
598
          type: string
599

    
600
    InsertUnit:
601
      type: object
602
      properties:
603
        unit_id:
604
          type: integer
605
        description:
606
          type: string
607

    
608
    InsertSensor:
609
      type: object
610
      properties:
611
        sensor_id:
612
          type: integer
613
        sensor_name:
614
          type: string
615
        sensor_type:
616
          type: string
617
        phenomenon:
618
          $ref: '#/components/schemas/InsertPhenomenon'
619

    
620
    InsertPhenomenon:
621
      type: object
622
      properties:
623
        phenomenon_id:
624
          type: integer
625

    
626
    UserCookie:
627
      type: object
628
      properties:
629
        sessionid:
630
          type: string
631
        language:
632
          type: string
633
        audio:
634
          type: boolean
635
        rightsID:
636
          type: integer
637

    
638
    UserInfo:
639
      type: object
640
      properties:
641
        userId:
642
          type: integer
643
        userName:
644
          type: string
645
        userPass:
646
          type: string
647
        userRealName:
648
          type: string
649
        groupId:
650
          type: integer
651
        "rightsId":
652
          type: integer
653

    
654
    Group:
655
      type: object
656
      properties:
657
        id:
658
          type: integer
659
        parent_group_id:
660
          type: integer
661
        group_name:
662
          type: string
663
        has_children:
664
          type: boolean
665

    
666
    Unit:
667
      type: object
668
      properties:
669
        description:
670
          type: string
671
        holderId:
672
          type: integer
673
        unitId:
674
          type: integer
675

    
676
    Phenomenon:
677
      type: object
678
      properties:
679
        phenomenonId:
680
          type: string
681
        phenomenonName:
682
          type: string
683
        unit:
684
          type: string
685

    
686
    Sensor:
687
      type: object
688
      properties:
689
        firstObservationTime:
690
          type: string
691
          format: date-time
692
        lastObservationTime:
693
          type: string
694
          format: date-time
695
        phenomenon:
696
          $ref: '#/components/schemas/Phenomenon'
697
        sensorId:
698
          type: integer
699
        sensorName:
700
          type: string
701
        sensorType:
702
          type: string
703

    
704
    Position:
705
      type: object
706
      properties:
707
        SRID:
708
          type: string
709
        gid:
710
          type: integer
711
        group_id:
712
          type: integer
713
        postgisGeomString:
714
          type: string
715
        postgisString:
716
          type: string
717
        speed:
718
          type: integer
719
        time_stamp:
720
          type: string
721
          format: date-time
722
        unit_id:
723
          type: integer
724
        x:
725
          type: number
726
        y:
727
          type: number
728

    
729
    Attributes:
730
      type: object
731
      properties:
732
        is_online:
733
          type: boolean
734
        is_moving:
735
          type: boolean
736

    
737
    AlertEvents:
738
      type: array
739

    
740
    Lastpos:
741
      type: object
742
      properties:
743
        alertEvents:
744
          $ref: '#/components/schemas/AlertEvents'
745
        attributes:
746
          $ref: '#/components/schemas/Attributes'
747
        position:
748
          $ref: '#/components/schemas/Position'
749

    
750
    GeneralInfo:
751
      type: array
752

    
753
    Drivers:
754
      type: array
755

    
756
    Sensors:
757
      type: object
758
      properties:
759
        sensorsData:
760
          $ref: '#/components/schemas/SensorsData'
761

    
762
    SensorsData:
763
      type: object
764
      properties:
765
        interval:
766
          type: number
767
        data:
768
          $ref: '#/components/schemas/Data'
769
        statistics:
770
          $ref: '#/components/schemas/Statistics'
771

    
772
    Data:
773
      type: object
774
      properties:
775
        observation:
776
          $ref: '#/components/schemas/Observation'
777

    
778
    Observation:
779
      type: object
780
      properties:
781
        min:
782
          type: number
783
        max:
784
          type: number
785
        avg:
786
          type: number
787
        sum:
788
          type: number
789
        timestamp:
790
          type: string
791
          format: date-time
792

    
793
    Statistics:
794
      type: object
795
      properties:
796
        min:
797
          type: number
798
        max:
799
          type: number
800
        avg:
801
          type: number
802
        sum:
803
          type: number
804

    
805
    OldObservation:
806
      type: object
807
      properties:
808
        gid:
809
          type: integer
810
        time:
811
          type: string
812
          format: date-time
813
        value:
814
          type: number
815

    
816
    SensorType:
817
      type: object
818
      properties:
819
        phenomenon:
820
          $ref: '#/components/schemas/Phenomenon'
821
        sensorId:
822
          type: integer
823
        sensorName:
824
          type: string
825
        sensorType:
826
          type: string
827

    
828

    
829

    
830

    
831

    
    (1-1/1)