-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsparks.yaml
603 lines (583 loc) · 18 KB
/
sparks.yaml
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
openapi: 3.0.0
info:
version: 1.0.2
title: Spark Works IoT Data Analytics API
description: AP Interface for deployements of the SparkWorks IoT Data Analytics Platform
contact:
name: Spark Works Ltd
url: 'https://www.sparkworks.net/'
email: info@sparkworks.net
servers:
- url: 'https://api.{deployment}.sparkworks.cloud/{version}'
variables:
deployment:
default: demo
description: Customer ID assigned
version:
default: v1
description: API version
description: deployment url
tags:
- name: Group API
description: Group Operations
- name: Thing API
description: Thing Operations
paths:
'/group':
get:
tags:
- Group API
summary: Retrieve a list of the available groups
description: Lists all available groups in the deployment.
operationId: RegistryGroupsFunction
security:
- cognitoOAuth2: [ ]
parameters:
- $ref: '#/components/parameters/perPageParam'
- $ref: '#/components/parameters/pageKey'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupListDTO'
'/group/{groupId}':
get:
tags:
- Group API
summary: Retrieve the data for a group by its id
description: Retrieve the latest values received from a single device and its stored description. The response contains the latest values received from the device, as well as all the properties stored in the platform for this specific device.
operationId: RegistryGroupFunction
parameters:
- name: groupId
in: path
description: The id of the group
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupDTO'
'/group/{groupId}/thing':
get:
tags:
- Group API
summary: Retrieve a list of Things for a Group by its id
description: Retrieve the latest values received from a single device and its stored description. The response contains the latest values received from the device, as well as all the properties stored in the platform for this specific device.
operationId: RegistryGroupThingsFunction
parameters:
- name: groupId
in: path
description: The id of the group
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThingListDTO'
'/thing':
get:
tags:
- Thing API
summary: Retrieve a list of Things
description: Retrieve the latest values received from a single device and its stored description. The response contains the latest values received from the device, as well as all the properties stored in the platform for this specific device.
operationId: RegistryThingsFunction
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThingListDTO'
'/group/{groupId}/thing/{thingId}':
get:
tags:
- Thing API
summary: Retrieve the data for a Thing by its id and Group id
description: Retrieve the latest values received from a single device and its stored description. The response contains the latest values received from the device, as well as all the properties stored in the platform for this specific device.
operationId: RegistryGroupThingFunction
parameters:
- name: groupId
in: path
description: The id of the group
required: true
schema:
type: string
- name: thingId
in: path
description: The id of the thing
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThingDTO'
'/group/{groupId}/thing/{thingId}/{measure}/query/timerange':
post:
tags:
- Thing API
summary: Retrieve raw data for a single Thing
description: Retrieve all data for the given measure and device on a specific interval. The response contains all the raw data received from the device in the given from-to period.
operationId: queryRaw
parameters:
- $ref: '#/components/parameters/perPageParam'
- name: groupId
in: path
description: The id of the group
required: true
schema:
type: string
- name: thingId
in: path
description: The id of the thing
required: true
schema:
type: string
- name: measure
in: path
description: The measure to query data for
required: true
schema:
type: string
format: device
enum: [ 'temperature', 'humidity', "noise", "illuminance", "all" ]
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TimeRangeRequestDTO'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TimeRangeResultDTO'
'/group/{groupId}/attribute':
post:
tags:
- Group API
summary: Update attributes of a Group
description: Add or replace attributes of a Group. If a value is null, the attribute will be removed
operationId: RegistryGroupAttributesUpdateFunction
parameters:
- name: groupId
in: path
description: The id of the group
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
example:
name: 'somename'
description: 'somedescription'
attr3: 'hello'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupDTO'
'/group/{groupId}/thing/{thingId}/attribute':
post:
tags:
- Thing API
summary: Update attributes of a Thing
description: Add or replace attributes of a Thing. If a value is null, the attribute will be removed
operationId: RegistryThingAttributesUpdateFunction
parameters:
- name: groupId
in: path
description: The id of the Group
required: true
schema:
type: string
- name: thingId
in: path
description: The id of the Thing
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
example:
name: 'somename'
description: 'somedescription'
attr3: 'hello'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ThingDTO'
components:
securitySchemes:
'AMBITIOUS Authentication':
type: oauth2
flows:
implicit: # Use "implicit" flow if no backend involved
authorizationUrl: https://sparks-datalake-ambitious.auth.eu-west-1.amazoncognito.com/oauth2/authorize
scopes:
openid: Access OpenID Connect
profile: Access user profile
email: Access email information
'FLEETK Authentication':
type: oauth2
flows:
implicit: # Use "implicit" flow if no backend involved
authorizationUrl: https://sparks-datalake-fleetk.auth.eu-west-1.amazoncognito.com/oauth2/authorize
scopes:
openid: Access OpenID Connect
profile: Access user profile
email: Access email information
parameters:
perPageParam:
in: query
name: perPage
required: false
schema:
type: integer
minimum: 20
maximum: 100
default: 20
description: The number of results per page to return.
pageKey:
in: query
name: pageKey
required: false
schema:
type: string
description: The index to the next page of entities.
device:
in: query
name: device
required: false
schema:
type: string
example: 'ea707af9de8b4357'
description: List of device names to filter data for, separated by commas.
tenant:
in: query
name: tenant
required: false
schema:
type: string
example: 'wellics'
description: Tenant name to filter data for.
space:
in: query
name: space
required: false
schema:
type: string
example: 'office'
description: Space name to filter data for.
schemas:
MetadataDTO:
title: MetadataDTO API Model
type: object
properties:
perPage:
title: Number of results per page
type: number
format: int64
example: 20
nextPageKey:
title: Key to access the next page of data
type: string
format: string
example: 'AQJp....zteQ=='
currentPageKey:
title: Key of the requested page
type: string
format: string
example: 'ADJp....zteD=='
GroupListDTO:
title: GroupListDTO API Model
type: object
description: List of the devices
properties:
_metadata:
title: Metadata
description: Pagination metadata
type: array
items:
$ref: '#/components/schemas/MetadataDTO'
groups:
title: Device data
type: array
description: Array of the devices
items:
$ref: '#/components/schemas/GroupDTO'
GroupDTO:
title: GroupDTO API Model
type: object
description: Group data object
properties:
group:
title: The name of the group
type: string
description: Indication of whether a sensor device has stopped transmitting measurements
attributes:
$ref: '#/components/schemas/GroupAttributesDTO'
GroupAttributesDTO:
title: GroupAttributesDTO API Model
description: Group attributes
type: object
properties:
name:
type: string
example: group-name
description:
type: string
example: some description
attr3:
type: string
format: attr3
example: hello
ThingListDTO:
title: ThingListDTO API Model
type: object
description: List of Things
properties:
_metadata:
title: Metadata
description: Pagination metadata
type: array
items:
$ref: '#/components/schemas/MetadataDTO'
things:
title: Things data
type: array
description: Array of the Things
items:
$ref: '#/components/schemas/ThingDTO'
ThingDTO:
title: ThingDTO API Model
type: object
description: Thing data object
properties:
group:
title: The name of the group
type: string
description: Indication of whether a sensor device has stopped transmitting measurements
example: 'groupId'
thing:
title: The id of the thing
type: string
description: The id of the thing
example: 'thingId'
typeName:
title: The type of the device
type: string
description: The type of the device
format: type_name
example: 'someTypeName'
status:
title: The current status of the device, based on lastUpdate
type: string
description: Indication of whether a sensor device has stopped transmitting measurements
format: status
enum: [ 'ONLINE', 'OFFLINE' ]
attributes:
$ref: '#/components/schemas/ThingAttributesDTO'
lastUpdate:
type: integer
format: int64
example: 1613225568858
lastSensorValues:
title: Holder object with the device values
type: object
properties:
measure:
title: Measure name
type: string
format: measure
value:
title: Measured value
type: string
format: value
example:
temperature: 23.5
humidity: 43
illuminance: 46
noise: 2
sensorUnits:
title: Holder object with the device units
type: object
properties:
measure:
title: Measure name
type: string
format: measure
unit:
title: Measured unit
type: string
format: unit
example:
temperature: '°C'
humidity: '%'
illuminance: 'lux'
noise: 'raw'
ThingAttributesDTO:
title: ThingAttributesDTO API Model
description: Thing attributes
type: object
properties:
name:
type: string
example: somename
attr2:
type: string
format: attr2
example: hello
TimeRangeRequestDTO:
title: TimeRangeRequestDTO API Model
description: Timerange criteria
required:
- from
- to
type: object
properties:
from:
title: The UNIX timestamp of the start date for filtering
type: integer
description: The UNIX timestamp of the start date for filtering
format: int64
example: 1613225568858
to:
title: The UNIX timestamp of the end date for filtering
type: integer
description: The UNIX timestamp of the end date for filtering
format: int64
example: 1613325578858
TimeRangeResultDTO:
title: TimeRangeResultDTO API Model
description: Data query response
required:
- thing
- measure
- query.from
- query.to
- data
type: object
properties:
_metadata:
title: Metadata
description: Pagination metadata
type: array
items:
$ref: '#/components/schemas/MetadataDTO'
thing:
title: The id of the Thing
type: string
description: The id of the Thing
format: device
example: 'ea707af9de8b4357'
measure:
title: The name of the measurement
type: string
description: The name of the measurement
format: measure
example: 'all'
enum: [ 'temperature', 'humidity', "noise", "illuminance", "all" ]
query:
$ref: '#/components/schemas/TimeRangeRequestDTO'
data:
$ref: '#/components/schemas/MeasurementsDTO'
MeasurementsDTO:
title: MeasurementsDTO API Model
description: The API Model describing the measurements stored in the Spark Works platform API Model
type: object
properties:
temperature:
type: array
items:
type: object
properties:
timestamp:
title: The UNIX timestamp of the received measurement
type: integer
description: The UNIX timestamp of the Date when measurement was collected as provided by the device
format: int64
example: 1613225568858
value:
title: The value of the measurement
type: number
description: The value of the measurement
format: double
example: 23.2
humidity:
type: array
items:
type: object
properties:
timestamp:
title: The UNIX timestamp of the received measurement
type: integer
description: The UNIX timestamp of the Date when measurement was collected as provided by the device
format: int64
example: 1613225568859
value:
title: The value of the measurement
type: number
description: The value of the measurement
format: double
example: 30.7
noise:
type: array
items:
type: object
properties:
timestamp:
title: The UNIX timestamp of the received measurement
type: integer
description: The UNIX timestamp of the Date when measurement was collected as provided by the device
format: int64
example: 1613225568858
value:
title: The value of the measurement
type: number
description: The value of the measurement
format: double
example: 2.7
illuminance:
type: array
items:
type: object
properties:
timestamp:
title: The UNIX timestamp of the received measurement
type: integer
description: The UNIX timestamp of the Date when measurement was collected as provided by the device
format: int64
example: 1613225568859
value:
title: The value of the measurement
type: number
description: The value of the measurement
format: integer
example: 500