-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenapi.yaml
1034 lines (1021 loc) · 29.8 KB
/
openapi.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
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
openapi: 3.0.3
info:
title: ARD Eventhub
description: >-
ARD system to distribute real-time (live) metadata for primarily radio
broadcasts.
termsOfService: https://www.ard.de
contact:
email: [email protected]
license:
name: European Union Public License 1.2
url: 'https://spdx.org/licenses/EUPL-1.2.html'
version: 1.9.2
externalDocs:
description: ARD Eventhub Documentation
url: https://swrlab.github.io/ard-eventhub/
servers:
- url: /
description: Local (domain-relative) environment
tags:
- name: auth
description: Authentication services for Eventhub
- name: events
description: Manage events
- name: subscriptions
description: Access to subscription management
- name: topics
description: Access to topics details
paths:
/auth/login:
post:
tags:
- auth
summary: Swap login credentials for a token
operationId: authLoginPost
requestBody:
content:
application/json:
schema:
additionalProperties: false
type: object
properties:
email:
type: string
example: [email protected]
password:
type: string
example: my-password
responses:
'200':
description: Authentication successful
content:
application/json:
schema:
$ref: '#/components/schemas/authResponse'
'400':
description: Bad Request (invalid input)
content:
application/json:
schema:
$ref: '#/components/schemas/errorBadRequest'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/auth/refresh:
post:
tags:
- auth
summary: Swap refresh token for new id token
operationId: authRefreshPost
requestBody:
content:
application/json:
schema:
additionalProperties: false
type: object
properties:
refreshToken:
type: string
example: abcXYZ...
responses:
'200':
description: Authentication successful
content:
application/json:
schema:
$ref: '#/components/schemas/authResponse'
'400':
description: Bad Request (invalid input)
content:
application/json:
schema:
$ref: '#/components/schemas/errorBadRequest'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/auth/reset:
post:
tags:
- auth
summary: Request password reset email
operationId: authResetPost
requestBody:
content:
application/json:
schema:
type: object
properties:
email:
type: string
example: [email protected]
responses:
'200':
description: Request successful
content: {}
'400':
description: Bad Request (invalid input)
content:
application/json:
schema:
$ref: '#/components/schemas/errorBadRequest'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/events/de.ard.eventhub.v1.radio.track.next:
post:
tags:
- events
summary: Distribute a next track
operationId: eventPostV1RadioTrackNext
security:
- bearerAuth: []
requestBody:
$ref: '#/components/requestBodies/eventV1RadioTrack'
responses:
'201':
$ref: '#/components/responses/eventV1RadioTrack'
'400':
description: Bad Request (invalid input)
content:
application/json:
schema:
$ref: '#/components/schemas/errorBadRequest'
'401':
description: Missing authentication
content:
application/json:
schema:
$ref: '#/components/schemas/errorUnauthorized'
'403':
description: Invalid authorization
content:
application/json:
schema:
$ref: '#/components/schemas/errorForbidden'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/events/de.ard.eventhub.v1.radio.track.playing:
post:
tags:
- events
summary: Distribute a now-playing track
operationId: eventPostV1RadioTrackPlaying
security:
- bearerAuth: []
requestBody:
$ref: '#/components/requestBodies/eventV1RadioTrack'
responses:
'201':
$ref: '#/components/responses/eventV1RadioTrack'
'400':
description: Bad Request (invalid input)
content:
application/json:
schema:
$ref: '#/components/schemas/errorBadRequest'
'401':
description: Missing authentication
content:
application/json:
schema:
$ref: '#/components/schemas/errorUnauthorized'
'403':
description: Invalid authorization
content:
application/json:
schema:
$ref: '#/components/schemas/errorForbidden'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/subscriptions:
get:
tags:
- subscriptions
summary: List all subscriptions for this user
operationId: subscriptionList
security:
- bearerAuth: []
responses:
'200':
description: Subscriptions found
content:
application/json:
schema:
$ref: '#/components/schemas/subscriptionsList'
'401':
description: Missing authentication
content:
application/json:
schema:
$ref: '#/components/schemas/errorUnauthorized'
'403':
description: Invalid authorization
content:
application/json:
schema:
$ref: '#/components/schemas/errorForbidden'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
post:
tags:
- subscriptions
summary: Add a new subscription
operationId: subscriptionPost
security:
- bearerAuth: []
requestBody:
description: New event to be distributed to subscribers.
content:
application/json:
schema:
$ref: '#/components/schemas/subscriptionPost'
required: true
responses:
'201':
description: Subscription created
content:
application/json:
schema:
$ref: '#/components/schemas/subscriptionResponse'
'400':
description: Bad Request (invalid input)
content:
application/json:
schema:
$ref: '#/components/schemas/errorBadRequest'
'401':
description: Missing authentication
content:
application/json:
schema:
$ref: '#/components/schemas/errorUnauthorized'
'403':
description: Invalid authorization
content:
application/json:
schema:
$ref: '#/components/schemas/errorForbidden'
'404':
description: Topic for subscription not found
content:
application/json:
schema:
$ref: '#/components/schemas/errorNotFound'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/subscriptions/{name}:
get:
tags:
- subscriptions
summary: Get details about a single subscription from this user
operationId: subscriptionsGet
security:
- bearerAuth: []
parameters:
- name: name
in: path
description: '`name` of the desired subscription'
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Subscription found
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/subscriptionResponse'
'401':
description: Missing authentication
content:
application/json:
schema:
$ref: '#/components/schemas/errorUnauthorized'
'403':
description: Invalid authorization
content:
application/json:
schema:
$ref: '#/components/schemas/errorForbidden'
'404':
description: Subscription not found
content:
application/json:
schema:
$ref: '#/components/schemas/errorNotFound'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
delete:
tags:
- subscriptions
summary: Remove a single subscription by this user
operationId: subscriptionsDelete
security:
- bearerAuth: []
parameters:
- name: name
in: path
description: '`name` of the desired subscription'
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Subscription deleted
content:
application/json:
schema:
$ref: '#/components/schemas/subscriptionDeleted'
'401':
description: Missing authentication
content:
application/json:
schema:
$ref: '#/components/schemas/errorUnauthorized'
'403':
description: Invalid authorization
content:
application/json:
schema:
$ref: '#/components/schemas/errorForbidden'
'404':
description: Subscription not found
content:
application/json:
schema:
$ref: '#/components/schemas/errorNotFound'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
/topics:
get:
tags:
- topics
summary: List all available topics
operationId: topicsGet
security:
- bearerAuth: []
responses:
'200':
description: Topics found
content:
application/json:
schema:
$ref: '#/components/schemas/topicResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
components:
requestBodies:
eventV1RadioTrack:
description: >
New event to be distributed to subscribers.
The Eventhub format validation expects only a subset of these variables
as minimum set. All other fields are technically optional, but **highly
encouraged** to be included, so a best-possible metadata exchange is
possible.
The subset is defined in the list of required fields of Schemas
`eventV1PostBody`, resulting in this body:
```json
{
"type": "music",
"start": "2020-01-19T06:00:00+01:00",
"title": "Song name",
"services": [ { ... } ],
"playlistItemId": "swr3-5678"
}
```
Required fields not specified in the Schema, will cause your request to
fail.
The `id` is inserted by Eventhub as string-formatted number, but might
be a true string in the future, do not expect this string to remain
numbers only!
content:
application/json:
schema:
$ref: '#/components/schemas/eventV1PostBody'
required: true
responses:
eventV1RadioTrack:
description: >
Event created
*Note:* The first request of an event for an externalId that is not
registered yet, will return the status `failed: 1`. This indicates that
a new topic for the externalId has been created, and the request needs
to be repeated:
```json
"statuses": {
"published": 0,
"blocked": 0,
"failed": 1
}
```
If the request returns the status `blocked: 1`, it indicates that you
are not allowed to publish events under the given publisherId.
content:
application/json:
schema:
$ref: '#/components/schemas/eventV1ResBody'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
authResponse:
type: object
properties:
expiresIn:
type: number
description: TTL for the token in seconds
example: 3600
expires:
type: string
description: ISO8601 compliant timestamp for the token expiry
format: iso8601-timestamp
example: '2020-01-19T06:00:00+01:00'
token:
type: string
description: ready to use token for API queries
example: ey...
refreshToken:
type: string
description: refresh token to be used with `/auth/refresh`/ endpoint
example: A0...
user:
type: object
description: Firebase-type user object obtained by decoding the JWT token
trace:
type: string
example: null
errorBadRequest:
type: object
properties:
message:
type: string
example: request.body should have required property 'XYZ'
errors:
type: array
minItems: 1
items:
type: object
properties:
path:
type: string
example: .body.XYZ
message:
type: string
example: should have required property 'XYZ'
errorCode:
type: string
example: required.openapi.validation
trace:
type: string
example: null
errorUnauthorized:
type: object
properties:
message:
type: string
example: request.headers should have required property 'Authorization'
errors:
type: array
minItems: 1
items:
type: object
properties:
path:
type: string
example: .headers.authorization
message:
type: string
example: should have required property 'authorization'
errorCode:
type: string
example: required.user
trace:
type: string
example: null
errorNotFound:
type: object
properties:
message:
type: string
example: object 'object.name' not found
trace:
type: string
example: null
errorForbidden:
type: object
properties:
message:
type: string
example: user is missing required permission
errors:
type: array
minItems: 1
items:
type: object
properties:
path:
type: string
example: .headers.authorization
message:
type: string
example: should have required permission
errorCode:
type: string
example: required.user.permission
trace:
type: string
example: null
errorInternalServerError:
type: object
properties:
message:
type: string
example: Internal Server Error
trace:
type: string
example: null
services:
type: object
required:
- type
- externalId
- publisherId
properties:
type:
type: string
example: PermanentLivestream
enum:
- EventLivestream
- PermanentLivestream
externalId:
type: string
example: crid://swr.de/123450
publisherId:
type: string
description: >
External ID or globally unique identifier (Core ID) for the
associated publisher.
When no Core ID is provided, the External ID will be converted by
Eventhub.
example: '248000'
id:
type: string
description: Globally unique identifier, created by Eventhub
example: urn:ard:permanent-livestream:49267f7d67be180d
reference:
type: object
additionalProperties: false
required:
- type
- externalId
properties:
type:
type: string
enum:
- Episode
- Section
- Publication
- Broadcast
- Show
- Season
- Article
id:
type: string
pattern: ^urn:ard:[a-z0-9-]+:[a-z0-9-]+$
example: urn:ard:show:49267f7d67be180d
externalId:
type: string
example: crid://swr.de/123450
pattern: ^(c|b)rid://.+$
title:
type: string
url:
type: string
format: uri
alternateIds:
type: array
items:
type: string
example: https://normdb.ivz.cn.ard.de/sendereihe/427
eventV1PostBody:
additionalProperties: false
required:
- type
- start
- title
- services
- playlistItemId
type: object
description: >
**Please also note the details in the `POST /events/v1` endpoint
above!**
properties:
event:
type: string
description: If set, it needs to match the URL event parameter
example: de.ard.eventhub.v1.radio.track.playing
enum:
- de.ard.eventhub.v1.radio.track.playing
- de.ard.eventhub.v1.radio.track.next
type:
type: string
description: >-
The type of the element that triggered this event. See additional
file in docs for details.
example: music
enum:
- audio
- commercial
- jingle
- live
- music
- news
- traffic
- weather
start:
type: string
description: ISO8601 compliant timestamp
format: iso8601-timestamp
example: '2020-01-19T06:00:00+01:00'
length:
type: number
format: float
description: Scheduled length of the element in seconds
example: 240
nullable: true
title:
type: string
description: Representative title for external use
example: Song name
artist:
type: string
description: Pre-formatted artist information
example: Sam Feldt feat. Someone Else
nullable: true
contributors:
type: array
description: Full details about involved artists if available
nullable: true
items:
type: object
required:
- name
- role
properties:
name:
type: string
example: Sam Feldt
role:
type: string
example: artist
enum:
- artist
- author
- composer
- performer
- conductor
- choir
- leader
- ensemble
- orchestra
- soloist
- producer
- engineer
normDb:
type: object
description: Reference to an entity in ARD's Norm-DB catalog
nullable: true
properties:
type:
type: string
example: Person
id:
type: string
example: '1641010'
isni:
type: string
description: ISNI ID if available
nullable: true
externalDocs:
description: International Standard Name Identifier
url: >-
https://kb.ddex.net/display/HBK/Communication+of+Identifiers+in+DDEX+Messages
url:
type: string
description: Can link to external reference
nullable: true
services:
type: array
description: >-
The playing stations unique Service-IDs. Do not include the
Service-Type suffix.
items:
minItems: 1
allOf:
- $ref: '#/components/schemas/services'
references:
type: array
description: related external entities
nullable: true
items:
minItems: 0
allOf:
- $ref: '#/components/schemas/reference'
playlistItemId:
type: string
description: >-
Unique identifier (within a publisher) to connect next and playing
items if needed
example: swr3-5678
hfdbIds:
type: array
description: >-
Can reference all available tracks in ARD HFDB instances. Should
ideally at least include the common ZSK instance.
nullable: true
items:
type: string
example:
- swrhfdb1.KONF.12345
- zskhfdb1.KONF.12345
externalId:
type: string
description: Can reference the original ID in the publisher's system
example: M012345.001
nullable: true
isrc:
type: string
description: Appropriate ISRC code if track is a music element
example: DE012345678
nullable: true
upc:
type: string
description: Corresponding reference to an album where such ISRC was published
nullable: true
mpn:
type: string
description: If available the reference to the original delivery from MPN
nullable: true
media:
type: array
description: Can contain an array of media files like cover, artist, etc.
nullable: true
items:
required:
- type
- url
- description
type: object
properties:
type:
type: string
enum:
- cover
- artist
- anchor
- audio
- video
example: cover
url:
type: string
example: https://example.com/cover.jpg
templateUrl:
type: string
example: https://example.com/cover.jpg?width={width}
nullable: true
description:
type: string
example: Cover Demo Artist
attribution:
type: string
example: Photographer XYZ
nullable: true
plugins:
type: array
description: >-
Highly optional field for future third-party metadata distribution
or other connected services
nullable: true
items:
type: object
properties:
type:
type: string
example: postToThirdPartyPlatformXYZ
id:
type: string
description: >-
ID gets inserted by Eventhub as string-formatted number, but might
be a true string in the future, do not expect this string to remain
numbers only!
example: '1234567890'
eventV1ResBody:
type: object
properties:
statuses:
type: object
properties:
published:
type: integer
example: 1
blocked:
type: integer
example: 0
failed:
type: integer
example: 0
event:
$ref: '#/components/schemas/eventV1PostBody'
trace:
type: string
example: null
subscriptionPost:
required:
- type
- method
- url
- contact
- topic
type: object
properties:
type:
type: string
enum:
- PUBSUB
example: PUBSUB
method:
type: string
enum:
- PUSH
example: PUSH
url:
type: string
description: Publicly accessible URL that should receive the events
example: https://example.com/my/webhook/for/this/subscription
contact:
type: string
description: >-
Email address to be contacted in case of problems with this
subscription
example: [email protected]
topic:
type: string
description: ID of the topic to subscribe to
example: topic-id-to-subscribe-to
subscriptionsList:
type: array
items:
allOf:
- $ref: '#/components/schemas/subscriptionResponse'
subscriptionResponse:
type: object
properties:
type:
type: string
enum:
- PUBSUB
example: PUBSUB
method:
type: string
enum:
- PUSH
example: PUSH
name:
type: string
description: ID of the subscription to be referenced in API calls
example: de.ard.eventhub.subscription.subscription-id
path:
type: string
description: Path of subscription in project
example: projects/ard-eventhub/subscriptions/subscription-name
topic:
type: object
description: Object of the subscribed topic
properties:
id:
type: string
example: urn:ard:permanent-livestream:topic-id
name:
type: string
example: de.ard.eventhub.dev.urn%3Aard%3Apermanent-livestream%3Atopic-id
path:
type: string
example: projects/ard-eventhub/topics/topic-name
ackDeadlineSeconds:
type: integer
example: 20
retryPolicy:
type: string
example: null
serviceAccount:
type: string
example: name-of-service-account
url:
type: string
description: Publicly accessible URL that should receive the events
example: https://example.com/my/webhook/for/this/subscription
contact:
type: string
description: >-
Email address to be contacted in case of problems with this
subscription
example: [email protected]
institutionId:
type: string
description: ID of the institution the current user belongs to
example: urn:ard:institution:institution-id
subscriptionDeleted:
type: object
properties:
valid:
type: boolean
example: true
trace:
type: string
example: null
topicResponse:
type: array
items:
type: object
properties:
type: