-
Notifications
You must be signed in to change notification settings - Fork 48
/
quantumleap.yml
1606 lines (1568 loc) · 55.2 KB
/
quantumleap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
swagger: '2.0' # For 3.0 see (https://github.com/zalando/connexion/issues/420)
info:
title: "QuantumLeap API"
version: "0.1.2"
host: "localhost:8668" # it'll run in the same container, hence localhost.
basePath: /v2
produces:
- text/plain
- application/json
################################################################################
# DEFINITIONS
################################################################################
definitions:
# When having an official NGSI swagger, use external refs to avoid duplication
# (http://azimi.me/2015/07/16/split-swagger-into-smaller-files.html)
Entity:
type: object
required:
- "id"
- "type"
properties:
type:
type: string
example: Room
description: "The NGSI Entity Type."
id:
type: string
example: Kitchen
description: "The NGSI Entity Id."
Notification:
type: object
required:
- "data"
properties:
subscriptionId:
type: string
example: 5947d174793fe6f7eb5e3961
data:
type: array
items:
$ref: "#/definitions/Entity"
example:
subscriptionId: 5947d174793fe6f7eb5e3961
data:
- id: Kitchen
type: Room
temperature:
value: 24.2
type: "Number"
metadata:
dateModified:
type: "DateTime"
value: 2017-06-19T11:46:45.00Z
- id: Bedroom1
type: Room
temperature:
value: 26.4
type: "Number"
metadata:
dateModified:
type: "DateTime"
value: 2017-06-19T11:46:45.00Z
################################################################################
# DEFINITIONS: Response objects
################################################################################
IndexArray:
type: array
items:
type: string
description: "Array of the timestamps which are indexes of the response
for the requested data. It's a parallel array to 'values'. The timestamp
will be either in the ISO format or the milliseconds in UTC since epoch,
depending on the format the 'time_index' was created; always respecting
the original format in which data was inserted. When using aggregation
options, the format of this remains the same, only the semantics will
change. For example, if aggrPeriod is day, each index will be a valid
timestamp of a moment in the corresponding day."
ValuesArray:
type: array
items:
type: number
description: "Array of values of the selected attribute, in the same
corresponding order of the 'index' array. When using aggregation options,
the format of this remains the same, only the semantics will change. For
example, if aggrPeriod is day, each value of course may not correspond
to original measurements but rather the aggregate of measurements in
each day."
IndexedValues:
type: object
properties:
index:
$ref: '#/definitions/IndexArray'
values:
$ref: '#/definitions/ValuesArray'
AttributeValues:
type: object
properties:
attrName:
type: string
values:
$ref: '#/definitions/ValuesArray'
EntityIndexedValues:
type: object
properties:
entityId:
type: string
index:
$ref: '#/definitions/IndexArray'
values:
$ref: '#/definitions/ValuesArray'
################################################################################
# PARAMETERS: IN HEADERS
################################################################################
parameters:
fiwareService:
in: header
name: fiwareService
required: false
type: string
description: "The corresponding 'fiware-service' header.
See http://fiware-orion.readthedocs.io/en/latest/user/multitenancy/index.html#multi-tenancy"
fiwareServicePath:
in: header
name: fiwareServicePath
required: false
type: string
description: "The corresponding 'fiware-servicepath' header.
See http://fiware-orion.readthedocs.io/en/latest/user/multitenancy/index.html#multi-tenancy"
################################################################################
# PARAMETERS: IN PATH
################################################################################
# Unfortunately Swagger 2.0 does not support examples for parameters :(
entityTypeInPath:
in: path
required: true
name: entityType
type: string
description: "The entity type in which the query is restricted on. Used to
constraint the search to entities of this type, specially useful when the
entity id is not enough to uniquely identify an entity."
# example: Room # Only Valid in OAPI 3.0
entityIdInPath:
in: path
required: true
name: entityId
type: string
description: "The entity id in which the query is restricted on. If the id
is unique among all entity types, this could be used to uniquely identify
the entity instance. Otherwise, you will have to use the entityType
attribute to resolve ambiguity."
# example: Kitchen1 # Only Valid in OAPI 3.0
attrNameInPath:
in: path
required: true
name: attrName
type: string
description: "The name of the attribute the query is interested on. It must
be a valid attribute of all the entities covered by the query scope."
# example: temperature # Only Valid in OAPI 3.0
################################################################################
# PARAMETERS: IN QUERY
################################################################################
type:
in: query
name: type
type: string
description: "Comma-separated list of entity types whose data are to be
included in the response. Use only one (no comma) when required. If used to
resolve ambiguity for the given entityId, make sure the given entityId
exists for this entityType."
id:
in: query
name: id
type: string
description: "Optional. Comma-separated list of entity ids whose data are to
be included in the response."
idPattern:
in: query
name: idPattern
type: string
description: "A correctly formated regular expression. Retrieve entities
whose ID matches the regular expression. Incompatible with id."
attrs:
in: query
name: attrs
type: string
description: "Optional. Comma-separated list of attribute names whose data
are to be included in the response. The attributes are retrieved in the
order specified by this parameter. If not specified, all attributes are
included in the response in arbitrary order."
aggrMethod:
in: query
name: aggrMethod
type: string
enum: [count, sum, avg, min, max] # These taken from ISO standard on SQL.
# Remember Crate supports many others https://crate.io/docs/crate/reference/en/latest/sql/aggregation.html
description: "Optional. The function to apply to the raw data filtered by
the query parameters. If not given, the returned data are the same raw
inserted data."
aggrPeriod:
in: query
name: aggrPeriod
type: string
enum: [year, month, day, hour, minute, second]
description: "Optional. If not defined, the aggregation will apply to all
the values contained in the search result. If defined, the aggregation
function will instead be applied N times, once for each period, and all
those results will be considered for the response. For example, a query
asking for the average temperature of an attribute will typically return
1 value. However, with an aggregationPeriod of day, you get the daily
average of the temperature instead (more than one value assuming you
had measurements across many days within the scope of your search result)"
aggrScope:
in: query
name: aggrScope
type: string
enum: [global, entity]
default: entity
description: "Optional. (This parameter is not yet supported). When the
query results cover historical data for multiple entities instances, you
can define the aggregation method to be applied for each entity instance
[entity] or across them [global]."
options:
in: query
name: options
type: string
enum: [keyValues, values]
description: "Optional. (This parameter is not yet supported). Options
dictionary to format output. See definition in
NGSIv2 for example here: https://orioncontextbroker.docs.apiary.io/#reference/entities/list-entities/list-entities"
fromDate:
in: query
name: fromDate
type: string
description: "Optional. The starting date and time (inclusive) from which
the context information is queried. Must be in ISO8601 format (e.g.,
2018-01-05T15:44:34)"
toDate:
in: query
name: toDate
type: string
description: "Optional. The final date and time (inclusive) from which the
context information is queried. Must be in ISO8601 format (e.g.,
2018-01-05T15:44:34)"
lastN:
in: query
name: lastN
type: integer
description: "Optional. Used to request only the last N values that satisfy
the request conditions."
limit:
in: query
name: limit
type: integer
default: 10000
description: "Optional. Maximum number of results to retrieve in a single
response."
offset:
in: query
name: offset
type: integer
description: "Optional. Offset to apply to the response results. For
example, if the query was to return 10 results and you use an offset of
1, the response will return the last 9 values. Make sure you don't give
more offset than the number of results."
################################################################################
# PATHS: META
################################################################################
paths:
/version:
get:
operationId: reporter.version.version
summary: "Returns the version of QuantumLeap."
tags:
- meta
responses:
200:
description: "Successful response."
schema:
type: object
properties:
version:
type: string
examples:
application/json:
{
"version": "0.0.1"
}
/config:
post:
operationId: reporter.reporter.config
summary: "(To Be Implemented) Customize your persistance configuration to
better suit
your
needs."
description: ""
parameters:
- $ref: '#/parameters/type'
- in: query
name: replicas
type: number
description: "The number of replicas to use for the selected types."
tags:
- meta
responses:
501:
description: "Not implemented!"
schema:
type: string
/health:
get:
operationId: reporter.health.get_health
summary: "Returns the health-check status of QuantumLeap and the services
it depends on."
description: "This endpoint is intended for administrators of
QuantumLeap. Using the information returned by this endpoint they can
diagnose problems in the service or its dependencies. This information is
also useful for cloud tools such as orchestrators and load balancers
with rules based on health-checks. Due to the lack of a standardized
response format, we base the implementation on the draft of
https://inadarei.github.io/rfc-healthcheck/
QuantumlLeap's dependencies are the following:
- CrateDB: Critical
- Redis: Critical only if geocoding is enabled.
- OSM: Non-critical"
tags:
- meta
responses:
200:
description: "QuantumLeap health is OK, the service works as
expected."
schema:
type: object
properties:
status:
type: string
examples:
application/json:
{
"status": "pass"
}
207:
description: "QuantumLeap health may be OK, but some of its
dependencies report a warning status, or some of its non-critical
dependencies report a fail status, so you should double-check."
schema:
type: object
properties:
status:
type: string
details:
type: object
examples:
application/json:
{
"status": "warn",
"details": {
"crateDB": {
"status": "warn",
"time": "2018-01-01T00:00:00Z",
"output": "message-from-crateDB"
},
"redis": {
"status": "warn",
"time": "2018-01-01T00:00:00Z",
"output": "raw-error-from-redis"
}
}
}
424:
description: "QuantumLeap health is NOT OK, as some of its
dependencies report a failure status."
schema:
type: object
properties:
status:
type: string
details:
type: object
examples:
application/json:
{
"status": "fail",
"details": {
"crateDB": {
"status": "fail",
"time": "2018-01-01T00:00:00Z",
"output": "raw-error-from-crateDB"
},
"orion": {
"status": "fail",
"time": "2018-01-01T00:00:00Z",
"output": "raw-error-from-orion"
},
"redis": {
"status": "fail",
"time": "2018-01-01T00:00:00Z",
"output": "raw-error-from-redis"
},
"OSM": {
"componentType": "system",
"status": "pass",
"time": "2018-01-01T00:00:00Z"
},
"grafana": {
"componentType": "system",
"status": "pass",
"time": "2018-01-01T00:00:00Z"
}
}
}
################################################################################
# PATHS: INPUT
################################################################################
/notify:
post:
operationId: reporter.reporter.notify
summary: "Notify QuantumLeap the arrival of a new NGSI notification."
description: ""
parameters:
- in: body
name: notification
required: true
schema:
type: object
$ref: "#/definitions/Notification"
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
tags:
- input
responses:
201:
description: "Successfully created record."
400:
description: "Received notification is not valid."
500:
description: "Internal server error."
/subscribe:
post:
operationId: reporter.reporter.subscribe
summary: "Subscribe QL to process Orion notifications of certain type."
description: "This endpoint simplifies the creation of the subscription
in orion that will generate the notifications to be consumed by
QuantumLeap in order to save historical records. If you want an
advanced specification of the notifications, you can always create the
subscription in orion at your will. This endpoint just aims to
simplify the common use case."
parameters:
- in: query
name: orionUrl
required: true
type: string
description: "The url where QuantumLeap can reach Orion. Do not
include specific paths, just the base one including the api version.
E.g http://my-orion.com:1026/v2"
- in: query
name: quantumleapUrl
required: true
type: string
description: "The url where Orion can reach QuantumLeap. Do not
include specific paths, just the base one including the api version.
E.g http://my-quantumleap.com:8668/v2"
- in: query
name: entityType
required: false
type: string
description: "The type of entities for which to create a
subscription, so as to persist historical data of entities of this
type. ATTENTION: If not specified, all entity types will be tracked."
- in: query
name: idPattern
required: false
type: string
description: "The pattern covering the entity ids for which to
subscribe. If not specified, QL will track all entities of the
specified type. This attribute is documented in orion, see
https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html#subscriptions"
- in: query
name: attributes
required: false
type: string
description: "Comma-separated list of attribute names to keep
historical records. If not specified, QL will track all attributes of
the specified entities."
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
tags:
- input
responses:
201:
description: "Successfully created subscription."
412:
description: "You specified an unreachable Orion url for QuantumLeap."
500:
description: "Internal server error."
################################################################################
# PATHS: OUTPUT
################################################################################
/entities/{entityId}/attrs/{attrName}:
get:
operationId: reporter.query_1T1E1A.query_1T1E1A
summary: "History of an attribute of a given entity instance."
description: "For example, query max water level of the central tank
throughout the last year. Queries can get more sophisticated with the use
of filters and query attributes."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityIdInPath'
- $ref: '#/parameters/attrNameInPath'
# In Query...
- $ref: '#/parameters/type'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: object
properties:
entityId:
type: string
attrName:
type: string
index:
$ref: '#/definitions/IndexArray'
values:
$ref: '#/definitions/ValuesArray'
examples:
application/json:
{
"data": {
# Return type!?
"entityId": "Kitchen1",
"attrName": "temperature",
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
# TODO: in NGSI orion would return the type+metadata of attr
"values": [24.1, 25.3, 26.7]
}
}
404:
description: "Not Found"
schema:
type: object
properties:
error:
type: string
description:
type: string
examples:
application/json:
{
"error": "Not Found",
"description": "No records were found for such query."
}
/entities/{entityId}/attrs/{attrName}/value:
get:
operationId: reporter.query_1T1E1A.query_1T1E1A_value
summary: "History of an attribute (values only) of a given entity
instance."
description: "Similar to the previous, but focusing on the values
regardless of the metadata."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityIdInPath'
- $ref: '#/parameters/attrNameInPath'
# In Query...
- $ref: '#/parameters/type'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
200:
description: OK
schema:
type: object
properties:
data:
$ref: '#/definitions/IndexedValues'
examples:
application/json:
{
"data": {
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"values": [24.1, 25.3, 26.7]
}
}
404:
description: "Not Found"
schema:
type: object
properties:
error:
type: string
description:
type: string
examples:
application/json:
{
"error": "Not Found",
"description": "No records were found for such query."
}
/entities/{entityId}:
get:
operationId: reporter.query_1T1ENA.query_1T1ENA
summary: "History of N attributes of a given entity instance."
description: "For example, query the average pressure, temperature and
humidity of this month in the weather station WS1."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityIdInPath'
# In Query...
- $ref: '#/parameters/type'
- $ref: '#/parameters/attrs'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: object
properties:
entityId:
type: string
index:
$ref: '#/definitions/IndexArray'
attributes:
type: array
items:
$ref: '#/definitions/AttributeValues'
examples:
application/json:
{
"data": {
"entityId": "Kitchen1",
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"attributes": [
{
"attrName": "temperature",
"values": [24.1, 25.3, 26.7]
},
{
"attrName": "pressure",
"values": [1.01, 0.9, 1.02]
}
]
}
}
404:
description: "Not Found"
schema:
type: object
properties:
error:
type: string
description:
type: string
examples:
application/json:
{
"error": "Not Found",
"description": "No records were found for such query."
}
delete:
operationId: reporter.delete.delete_entity
summary: "Delete historical data of a certain entity."
description: "Given an entity (with type and id), delete all its
historical records."
tags:
- input
parameters:
# In Path...
- $ref: '#/parameters/entityIdInPath'
# In Query...
- $ref: '#/parameters/type'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
204:
description: "Records successfully deleted."
schema:
type: string
404:
description: "Not Found"
schema:
type: object
properties:
error:
type: string
description:
type: string
examples:
application/json:
{
"error": "Not Found",
"description": "No records were found for such query."
}
/entities/{entityId}/value:
get:
operationId: reporter.query_1T1ENA.query_1T1ENA_value
summary: "History of N attributes (values only) of a given entity
instance."
description: "For example, query the average pressure, temperature and
humidity (values only, no metadata) of this month in the weather station
WS1."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityIdInPath'
# In Query...
- $ref: '#/parameters/type'
- $ref: '#/parameters/attrs'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: object
properties:
index:
$ref: '#/definitions/IndexArray'
values:
type: array
items:
$ref: '#/definitions/AttributeValues'
examples:
application/json:
{
"data": {
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"values": [
{
"attrName": "temperature",
"values": [24.1, 25.3, 26.7]
},
{
"attrName": "pressure",
"values": [1.01, 0.9, 1.02]
}
]
}
}
404:
description: "Not Found"
schema:
type: object
properties:
error:
type: string
description:
type: string
examples:
application/json:
{
"error": "Not Found",
"description": "No records were found for such query."
}
/types/{entityType}/attrs/{attrName}:
get:
operationId: reporter.query_1TNE1A.query_1TNE1A
summary: "History of an attribute of N entities of the same type."
description: "For example, query the pressure measurements of this
month in all the weather stations. Note in the response, the index and
values arrays are parallel. Also, when using aggrMethod, the aggregation
is done by-entity instance. In this case, the index array is just the
fromDate and toDate values user specified in the request (if any)."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityTypeInPath'
- $ref: '#/parameters/attrNameInPath'
# In Query...
- $ref: '#/parameters/id'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: object
properties:
entityType:
type: string
attrName:
type: string
entities:
type: array
items:
$ref: '#/definitions/EntityIndexedValues'
examples:
# TODO: Maybe for this 'query all' we cloud keep a per-type index.
application/json:
{
"data": {
"entityType": "Room",
"attrName": "temperature",
"entities": [
{
"entityId": "Kitchen1",
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"values": [24.1, 25.3, 26.7]
},
{
"entityId": "Room2",
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"values": [21.01, 20.9, 21.02]
}
]
}
}
/types/{entityType}/attrs/{attrName}/value:
get:
operationId: reporter.query_1TNE1A.query_1TNE1A_value
summary: "History of an attribute (values only) of N entities of the
same type."
description: "For example, query the average pressure (values only,
no metadata) of this month in all the weather stations."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityTypeInPath'
- $ref: '#/parameters/attrNameInPath'
# In Query...
- $ref: '#/parameters/id'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: object
properties:
entities:
type: array
items:
$ref: '#/definitions/EntityIndexedValues'
examples:
# TODO: Maybe for this 'query all' we cloud keep a per-type index.
application/json:
{
"data": {
"values": [
{
"entityId": "Kitchen1",
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"values": [24.1, 25.3, 26.7]
},
{
"entityId": "Room2",
"index": ["2018-01-05T15:44:34", "2018-01-06T15:44:59",
"2018-01-07T15:44:59"],
"values": [21.01, 20.9, 21.02]
}
]
}
}
/types/{entityType}:
get:
operationId: reporter.reporter.query_1TNENA
summary: "(To Be Implemented) History of N attributes of N entities of
the same type."
description: "For example, query the average pressure, temperature and
humidity of this month in all the weather stations."
tags:
- queries
parameters:
# In Path...
- $ref: '#/parameters/entityTypeInPath'
# In Query...
- $ref: '#/parameters/id'
- $ref: '#/parameters/attrs'
- $ref: '#/parameters/aggrMethod'
- $ref: '#/parameters/aggrPeriod'
- $ref: '#/parameters/aggrScope'
- $ref: '#/parameters/options'
- $ref: '#/parameters/fromDate'
- $ref: '#/parameters/toDate'
- $ref: '#/parameters/lastN'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/offset'
# In Header...
- $ref: '#/parameters/fiwareService'
- $ref: '#/parameters/fiwareServicePath'