-
Notifications
You must be signed in to change notification settings - Fork 0
/
oas_apivideo.yaml
12621 lines (11451 loc) · 588 KB
/
oas_apivideo.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.0
x-stoplight:
id: ybzk39fiws46g
info:
title: api.video
description: 'api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes.'
version: '1'
servers:
- url: 'https://ws.api.video'
description: Production server
- url: 'https://sandbox.api.video'
description: 'Test server `all videos are watermarked, and deleted after 24 hours.'
paths:
/auth/api-key:
post:
tags:
- Advanced authentication
summary: Get Bearer Token
description: |-
Returns a bearer token that can be used to authenticate other endpoint.
You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
operationId: POST_auth-api-key
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/authenticate-payload'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/access-token'
examples:
response:
value:
token_type: Bearer
expires_in: 3600
access_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjUyZWM4NWUyMjFkODZjOWI0NDQ5NzBhMjQwMzUyOWQ4MDQyNGQ3ZmJjYjFlYWM2MjVlM2VkMjI2YWRlNTcxMDY2NDUyZDc0NjdhN2E4NjI0In0.eyJhdWQiOiJsaWJjYXN0IiwianRpIjoiNTJlYzg1ZTIyMWQ4NmM5YjQ0NDk3MGEyNDAzNTI5ZDgwNDI0ZDdmYmNiMWVhYzYyNWUzZWQyMjZhZGU1NzEwNjY0NTJkNzQ2N2E3YTg2MjQiLCJpYXQiOjE1MjUyNzYxNDcsIm5iZiI6MTUyNTI3NjE0NywiZXhwIjoxNTI1Mjc5NzQ3LCJzdWIiOiJ1c01vbml0b3IiLCJzY29wZXMiOlsibW9uaXRvci5saWJjYXN0LmNvbSJdLCJjb250ZXh0Ijp7InVzZXIiOiJ1c01vbml0b3IiLCJwcm9qZWN0IjoicHJNb25pdG9yIiwibWVtYmVyIjoibWVNb25pdG9yIn19.rUvishDNyJLNlI4W5VmguNecm5KD2uZgPkKJQbaqw-cJbSrVxkSbiKYtk_E3cz3WT7-IS2yFTsYN3uIo5Rbit8_HftweyEp2bdBRI8yjR6oZZ1sNJJXswISN1i2kk4r-aaxu7Xxf_LtsjOMUj_YZsvcc2nqBXPKjHbJCJryx3DDJaIcymOqao7nhQaCCQyrQooAXNTYs4E9fWN1dC_x2O-zok5TuG-xhEW-umwxfSUMWNgSTkz38ACceQ0PCJSgB3jqjDH4MwC7B3ppEPZuK5E6JhKeyRlalswRyYq3UQPnVeMTam7YQHsuTgbehF6WySW8i44o7V_MCe9hjPdp-WA
refresh_token: def50200a28d88fb9aaa921be78eeb5604b071101a334899a7d5fc7492cf8ea752962ddc8961fe5c126101d4ecacd980396eb2fd494995b812dffcb98256c4277f790d1f658fc2d2e34f350740544e5232d69d68d34c648271d706c5e7049adac0b1832d0fdf71809715cc7e97fa63f65966deadb501a55ff469b0fd23a637cb6acbe9d9b8594a17f09efc2efeed82984764a0065d5e29c950c7b081a61ba2aaa192be3085c400ee37eac50fa9320ce2cfe8916c8165418d23e9f91b6a5c8515e1d74ee193a5a1ca01954fbff27361c20184240be2359e0afbed0bf1c762cf872450b5e8b5d4704f4fd9583e4470adc98409dd42965709712806bd9019378a72eea0b4912ce684ffd833db5806ab84174f905db2a75380071d004615c944bb8f8c4045cce7234c2be9a2330522cf7f067b8e58f57cffb6edb4b7ef91313e12bcde47e5e76ceee7fa52990132288f345d33ed917ae4fd54b7284f8964d898e97e1ee3bc4157f75d7fee63976e4be66ac1ec32ef74afa533f0eb593523f226cbec57d196ac8962
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/bad-request'
examples:
response:
value:
type: 'https://docs.api.video/docs/authenticationinvalid_credentials'
title: The user credentials were incorrect.
name: ''
status: 400
x-client-action: authenticate
x-client-hidden: true
x-readme:
code-samples:
- language: go
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: node
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: php
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: python
code: |
#With the api.video API clients, authentication is taken care of with each client created.
# You get to skip this step!
- language: java
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: csharp
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: swift
code: |
// With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
/auth/refresh:
post:
tags:
- Advanced authentication
summary: Refresh Bearer Token
description: |-
Accepts the old bearer token and returns a new bearer token that can be used to authenticate other endpoint.
You can find the tutorial on using the disposable bearer token [here](https://docs.api.video/reference/disposable-bearer-token-authentication).
operationId: POST_auth-refresh
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/refresh-token-payload'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/access-token'
examples:
response:
value:
token_type: Bearer
expires_in: 3600
access_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjUyZWM4NWUyMjFkODZjOWI0NDQ5NzBhMjQwMzUyOWQ4MDQyNGQ3ZmJjYjFlYWM2MjVlM2VkMjI2YWRlNTcxMDY2NDUyZDc0NjdhN2E4NjI0In0.eyJhdWQiOiJsaWJjYXN0IiwianRpIjoiNTJlYzg1ZTIyMWQ4NmM5YjQ0NDk3MGEyNDAzNTI5ZDgwNDI0ZDdmYmNiMWVhYzYyNWUzZWQyMjZhZGU1NzEwNjY0NTJkNzQ2N2E3YTg2MjQiLCJpYXQiOjE1MjUyNzYxNDcsIm5iZiI6MTUyNTI3NjE0NywiZXhwIjoxNTI1Mjc5NzQ3LCJzdWIiOiJ1c01vbml0b3IiLCJzY29wZXMiOlsibW9uaXRvci5saWJjYXN0LmNvbSJdLCJjb250ZXh0Ijp7InVzZXIiOiJ1c01vbml0b3IiLCJwcm9qZWN0IjoicHJNb25pdG9yIiwibWVtYmVyIjoibWVNb25pdG9yIn19.rUvishDNyJLNlI4W5VmguNecm5KD2uZgPkKJQbaqw-cJbSrVxkSbiKYtk_E3cz3WT7-IS2yFTsYN3uIo5Rbit8_HftweyEp2bdBRI8yjR6oZZ1sNJJXswISN1i2kk4r-aaxu7Xxf_LtsjOMUj_YZsvcc2nqBXPKjHbJCJryx3DDJaIcymOqao7nhQaCCQyrQooAXNTYs4E9fWN1dC_x2O-zok5TuG-xhEW-umwxfSUMWNgSTkz38ACceQ0PCJSgB3jqjDH4MwC7B3ppEPZuK5E6JhKeyRlalswRyYq3UQPnVeMTam7YQHsuTgbehF6WySW8i44o7V_MCe9hjPdp-WA
refresh_token: def50200a28d88fb9aaa921be78eeb5604b071101a334899a7d5fc7492cf8ea752962ddc8961fe5c126101d4ecacd980396eb2fd494995b812dffcb98256c4277f790d1f658fc2d2e34f350740544e5232d69d68d34c648271d706c5e7049adac0b1832d0fdf71809715cc7e97fa63f65966deadb501a55ff469b0fd23a637cb6acbe9d9b8594a17f09efc2efeed82984764a0065d5e29c950c7b081a61ba2aaa192be3085c400ee37eac50fa9320ce2cfe8916c8165418d23e9f91b6a5c8515e1d74ee193a5a1ca01954fbff27361c20184240be2359e0afbed0bf1c762cf872450b5e8b5d4704f4fd9583e4470adc98409dd42965709712806bd9019378a72eea0b4912ce684ffd833db5806ab84174f905db2a75380071d004615c944bb8f8c4045cce7234c2be9a2330522cf7f067b8e58f57cffb6edb4b7ef91313e12bcde47e5e76ceee7fa52990132288f345d33ed917ae4fd54b7284f8964d898e97e1ee3bc4157f75d7fee63976e4be66ac1ec32ef74afa533f0eb593523f226cbec57d196ac8962
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/bad-request'
examples:
response:
value:
status: 400
type: 'https://docs.api.video/docs/authenticationinvalid_credentials'
title: The user credentials were incorrect.
name: ''
x-client-action: refresh
x-client-hidden: true
x-readme:
code-samples:
- language: go
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: node
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: php
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: python
code: |
#With the api.video API clients, authentication is taken care of with each client created.
# You get to skip this step!
- language: java
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: csharp
code: |
//With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
- language: swift
code: |
// With the api.video API clients, authentication is taken care of with each client created.
// You get to skip this step!
/videos:
get:
tags:
- Videos
summary: List all video objects
description: List all the video objects that are associated with the current workspace.
x-client-description:
default: 'This method returns a list of your videos (with all their details). With no parameters added, the API returns the first page of all videos. You can filter videos using the parameters described below.'
operationId: LIST-videos
parameters:
- name: title
in: query
description: The title of a specific video you want to find. The search will match exactly to what term you provide and return any videos that contain the same term as part of their titles.
required: false
style: form
explode: true
schema:
type: string
example: My Video.mp4
- name: 'tags[]'
in: query
description: A tag is a category you create and apply to videos. You can search for videos with particular tags by listing one or more here. Only videos that have all the tags you list will be returned.
required: false
style: form
explode: true
schema:
type: array
items:
type: string
example: '["captions", "dialogue"]'
- name: metadata
in: query
description: 'Videos can be tagged with metadata tags in key:value pairs. You can search for videos with specific key value pairs using this parameter. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) allows you to define a key that allows any value pair.'
required: false
style: deepObject
x-is-deep-object: true
explode: true
schema:
type: object
additionalProperties:
type: string
example: 'metadata[Author]=John Doe&metadata[Format]=Tutorial'
- name: description
in: query
description: 'If you described a video with a term or sentence, you can add it here to return videos containing this string.'
required: false
style: form
explode: true
schema:
type: string
example: New Zealand
- name: liveStreamId
in: query
description: 'If you know the ID for a live stream, you can retrieve the stream by adding the ID for it here.'
required: false
style: form
explode: true
schema:
type: string
example: li400mYKSgQ6xs7taUeSaEKr
- name: sortBy
in: query
description: 'Allowed: title, createdAt, publishedAt, updatedAt. You can sort videos by the their created time, published time, updated time, or by title.'
required: false
style: form
explode: true
schema:
type: string
example: publishedAt
- name: sortOrder
in: query
description: 'Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A.'
required: false
style: form
explode: true
schema:
type: string
example: asc
- $ref: '#/components/parameters/current-page'
- $ref: '#/components/parameters/page-size'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/videos-list-response'
examples:
response:
value:
data:
- videoId: vi4blUQJFrYWbaG44NChkH27
playerId: pl45KFKdlddgk654dspkze
title: Maths video
description: An amazing video explaining the string theory
public: false
panoramic: false
mp4Support: true
tags:
- maths
- string theory
- video
metadata:
- key: Author
value: John Doe
- key: Format
value: Tutorial
publishedAt: '2019-12-16T08:25:51.000Z'
updatedAt: '2019-12-16T08:48:49.000Z'
source:
uri: /videos/c188ed58-3403-46a2-b91b-44603d10b2c9/source
assets:
iframe: '<iframe src="https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27" width="100%" height="100%" frameborder="0" scrolling="no" allowfullscreen=""></iframe>'
player: 'https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27'
hls: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/hls/manifest.m3u8'
thumbnail: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/thumbnail.jpg'
mp4: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/mp4/source.mp4'
- videoId: vi4blUQJFrYWbaG44NChkH27
title: Video Title
description: A description for your video.
public: false
panoramic: false
mp4Support: true
tags:
- books
- short stories
metadata:
- key: Author
value: John Doe
- key: Science Fiction
value: Cyberpunk
- key: Technology
value: Computers
publishedAt: '2019-12-16T08:25:51.000Z'
updatedAt: '2019-12-16T08:48:49.000Z'
source:
uri: /videos/vi4blUQJFrYWbaG44NChkH27/source
assets:
iframe: '<iframe src="https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27" width="100%" height="100%" frameborder="0" scrolling="no" allowfullscreen=""></iframe>'
player: 'https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27'
hls: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/hls/manifest.m3u8'
thumbnail: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/thumbnail.jpg'
mp4: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/mp4/source.mp4'
- videoId: vi4blUQJFrYWbaG44NChkH27
playerId: pl45KFKdlddgk654dspkze
title: My Video Title
description: A brief description of the video.
public: false
panoramic: false
mp4Support: true
tags:
- General
- Videos
metadata:
- key: Length
value: Short
publishedAt: '2019-12-16T08:25:51.000Z'
updatedAt: '2019-12-16T08:48:49.000Z'
source:
uri: /videos/vi4blUQJFrYWbaG44NChkH27/source
assets:
iframe: '<iframe src="https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27" width="100%" height="100%" frameborder="0" scrolling="no" allowfullscreen=""></iframe>'
player: 'https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27'
hls: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/hls/manifest.m3u8'
thumbnail: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/thumbnail.jpg'
mp4: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/mp4/source.mp4'
pagination:
currentPage: 1
pageSize: 25
pagesTotal: 1
itemsTotal: 11
currentPageItems: 11
links:
- rel: self
uri: 'https://ws.api.video/videos?currentPage=1'
- rel: first
uri: 'https://ws.api.video/videos?currentPage=1'
- rel: last
uri: 'https://ws.api.video/videos?currentPage=1'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/bad-request'
examples:
response:
value:
title: This parameter is out of the allowed range of values.
name: page
status: 400
range:
min: 1
problems:
- title: This parameter is out of the allowed range of values.
name: page
range:
min: 1
- title: This parameter is out of the allowed range of values.
name: pageSize
range:
min: 10
max: 100
security:
- apiKey: []
x-readme:
code-samples:
- language: php
code: |
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/VideosApi.md#list
require __DIR__ . '/vendor/autoload.php';
$client = new \ApiVideo\Client\Client(
'https://ws.api.video',
'YOUR_API_KEY',
new \Symfony\Component\HttpClient\Psr18Client()
);
// list all videos (all pages)
$allVideos = [];
$currentPage = 1;
do {
$currentPageVideos = $client->videos()->list(['currentPage' => $currentPage++]);
$allVideos = array_merge($allVideos, $currentPageVideos->getData());
} while($currentPage <= $currentPageVideos->getPagination()->getPagesTotal());
// list videos that have all the given tags (only first results page)
$videosWithTag = $client->videos()->list(['tags' => ['TAG2','TAG1']]);
// list videos that have all the given metadata values (only first results page)
$videosWithMetadata = $client->videos()->list(['metadata' => ['key1' => 'key1value1', 'key2' => 'key2value1']]);
- language: java
code: |-
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/VideosApi.md#list
ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
VideosApi videosApi = client.videos();
// list all videos (all pages)
Page<Video> videosPages = videosApi.list().execute();
videosPages.forEach(videosPage -> videosPage.getItems().forEach(video ->
System.out.println(video.getVideoId())
));
// list videos that have all the given tags (only first results page)
List<Video> videosWithTags = videosApi.list()
.tags(Arrays.asList("tag1", "tag2"))
.execute()
.getItems();
// list videos that have all the given metadata values (only first results page)
List<Video> videosWithMetadata = videosApi.list()
.metadata(Map.of("key1", "value1", "key2", "value2"))
.execute()
.getItems();
- language: node
code: |-
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/VideosApi.md#list
const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });
// list all videos (all pages)
let allVideos = [];
for(let currentPage=1 ; ; currentPage++) {
const res = await client.videos.list({ currentPage });
allVideos = [...allVideos, ...res.data];
if(currentPage >= res.pagination.pagesTotal) {
break;
}
}
// list videos that have all the given tags (only first results page)
const videosWithTags = await client.videos.list({ tags: ["tag1", "tag2"] });
// list videos that have all the given metadata values (only first results page)
const videosWithMetadata = await client.videos.list({ metadata: { "key1": "value1", "key2": "value2" } })
- language: csharp
code: |
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/VideosApi.md#list
- language: go
code: |
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/VideosApi.md#list
- language: python
code: |
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/VideosApi.md#list
- language: swift
code: |
// First install the api client: https://github.com/apivideo/api.video-ios-client#getting-started
// Documentation: https://github.com/apivideo/api.video-ios-client/blob/main/docs/VideosAPI.md#list
x-client-action: list
x-group-parameters: true
x-client-paginated: true
x-optional-object: true
post:
tags:
- Videos
summary: Create a video object
description: |
Creates a video object. More information on video objects can be found [here](https://docs.api.video/reference/videos-1).
operationId: POST-video
requestBody:
description: video to create
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/video-creation-payload'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/video'
examples:
response:
value:
videoId: vi4blUQJFrYWbaG44NChkH27
title: Maths video
description: An amazing video explaining the string theory
public: false
panoramic: false
mp4Support: true
playerId: pl4k0jvEUuaTdRAEjQ4Jfrgz
tags:
- maths
- string theory
- video
metadata:
- key: Author
value: John Doe
- key: Format
value: Tutorial
publishedAt: '4665-07-14T23:36:18.598Z'
source:
uri: /videos/vi4blUQJFrYWbaG44NChkH27/source
assets:
iframe: '<iframe src="https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27" width="100%" height="100%" frameborder="0" scrolling="no" allowfullscreen=""></iframe>'
player: 'https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27'
hls: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/hls/manifest.m3u8'
thumbnail: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/thumbnail.jpg'
mp4: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/mp4/source.mp4'
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/video'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/bad-request'
examples:
response:
value:
type: 'https://docs.api.video/docs/attributerequired'
title: This attribute is required.
name: title
status: 400
problems:
- type: 'https://docs.api.video/docs/attributerequired'
title: This attribute is required.
name: title
- type: 'https://docs.api.video/docs/attributeinvalid'
title: This attribute must be a ISO8601 date.
name: scheduledAt
- type: 'https://docs.api.video/docs/attributeinvalid'
title: This attribute must be an array.
name: tags
- type: 'https://docs.api.video/docs/attributeinvalid'
title: This attribute must be an array.
name: metadata
security:
- apiKey: []
x-client-action: create
x-readme:
code-samples:
- language: go
code: |
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/VideosApi.md#create
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
videoCreationPayload := *apivideosdk.NewVideoCreationPayload("Maths video") // VideoCreationPayload | video to create
res, err := client.Videos.Create(videoCreationPayload)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Videos.Create``: %v\
", err)
}
// response from `Create`: Video
fmt.Fprintf(os.Stdout, "Response from `Videos.Create`: %v\
", res)
}
- language: node
code: |
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/VideosApi.md#create
const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });
// create a simple video
const video = await client.videos.create({ title: "Maths video" });
// create a video using an existing source
const existingSourceVideo = await client.videos.create({
title: "Video using an existing source",
source: "https://www.myvideo.url.com/video.mp4",
});
// create a private video
const privateVideo = await client.videos.create({
title: "Video using an existing source",
_public: false,
});
// create a video using all available attributes
const video = await client.videos.create({
title: "Maths video", // The title of your new video.
description: "A video about string theory.", // A brief description of your video.
source: "https://www.myvideo.url.com/video.mp4", // If you add a video already on the web, this is where you enter the url for the video.
_public: true, // Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view.
panoramic: false, // Indicates if your video is a 360/immersive video.
mp4Support: true, // Enables mp4 version in addition to streamed version.
playerId: "pl45KFKdlddgk654dspkze", // The unique identification number for your video player.
tags: ["maths", "string theory", "video"], // A list of tags you want to use to describe your video.
metadata: [{"key": "Author", "value": "John Doe"}], // A list of key value pairs that you use to provide metadata for your video. These pairs can be made dynamic, allowing you to segment your audience. You can also just use the pairs as another way to tag and categorize your videos.
});
- language: php
code: |
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/VideosApi.md#create
require __DIR__ . '/vendor/autoload.php';
$client = new \ApiVideo\Client\Client(
'https://ws.api.video',
'YOUR_API_KEY',
new \Symfony\Component\HttpClient\Psr18Client()
);
// create a simple video
$video = $client->videos()->create((new \ApiVideo\Client\Model\VideoCreationPayload())->setTitle("Maths video"));
// create a video using an existing source
$existingSourceVideo = $client->videos()->create((new \ApiVideo\Client\Model\VideoCreationPayload())
->setTitle("Maths video")
->setSource("https://www.myvideo.url.com/video.mp4"));
// create a private video
$privateVideo = $client->videos()->create((new \ApiVideo\Client\Model\VideoCreationPayload())
->setTitle("Maths video")
->setPublic(false));
// create a video using all available attributes
$anotherVideo = $client->videos()->create((new \ApiVideo\Client\Model\VideoCreationPayload())
->setTitle("Maths video") // The title of your new video.
->setDescription("A video about string theory.") // A brief description of your video.
->setSource("https://www.myvideo.url.com/video.mp4") // If you add a video already on the web, this is where you enter the url for the video.
->setPublic(true) // Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view.
->setPanoramic(false) // Indicates if your video is a 360/immersive video.
->setMp4Support(true) // Enables mp4 version in addition to streamed version.
->setPlayerId("pl45KFKdlddgk654dspkze") // The unique identification number for your video player.
->setTags(array("TAG1", "TAG2")) // A list of tags you want to use to describe your video.
->setMetadata(array( // A list of key value pairs that you use to provide metadata for your video. These pairs can be made dynamic, allowing you to segment your audience. You can also just use the pairs as another way to tag and categorize your videos.
new \ApiVideo\Client\Model\Metadata(['key' => 'key1', 'value' => 'key1value1']),
new \ApiVideo\Client\Model\Metadata(['key' => 'key2', 'value' => 'key2value1']))));
- language: python
code: |
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/VideosApi.md#create
import apivideo
from apivideo.api import videos_api
from apivideo.model.video_creation_payload import VideoCreationPayload
from apivideo.model.bad_request import BadRequest
from apivideo.model.video import Video
from pprint import pprint
# Enter a context with an instance of the API client
with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
# Create an instance of the API class
api_instance = videos_api.VideosApi(api_client)
video_creation_payload = VideoCreationPayload(
title="Maths video",
description="A video about string theory.",
source="https://www.myvideo.url.com/video.mp4",
public=True,
panoramic=False,
mp4_support=True,
player_id="pl45KFKdlddgk654dspkze",
tags=["maths", "string theory", "video"],
metadata=[
Metadata(
key="Color",
value="Green",
),
],
) # VideoCreationPayload | video to create
# example passing only required values which don't have defaults set
try:
# Create a video
api_response = api_instance.create(video_creation_payload)
pprint(api_response)
except apivideo.ApiException as e:
print("Exception when calling VideosApi->create: %s\n" % e)
- language: java
code: |
// First add the "video.api:java-api-client" maven dependency to your project
// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/VideosApi.md#create
import video.api.client.ApiVideoClient;
import video.api.client.api.ApiException;
import video.api.client.api.models.*;
import video.api.client.api.clients.VideosApi;
import java.util.*;
public class Example {
public static void main(String[] args) {
ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY");
// if you rather like to use the sandbox environment:
// ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX);
VideosApi apiInstance = client.videos();
VideoCreationPayload videoCreationPayload = new VideoCreationPayload(); // video to create
videoCreationPayload.setTitle("Maths video"); // The title of your new video.
videoCreationPayload.setDescription("A video about string theory."); // A brief description of your video.
videoCreationPayload.setSource("https://www.myvideo.url.com/video.mp4"); // If you add a video already on the web, this is where you enter the url for the video.
videoCreationPayload.setPublic(true); // Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view.
videoCreationPayload.setPanoramic(false); // Indicates if your video is a 360/immersive video.
videoCreationPayload.setMp4Support(true); // Enables mp4 version in addition to streamed version.
videoCreationPayload.setPlayerId("pl45KFKdlddgk654dspkze"); // The unique identification number for your video player.
videoCreationPayload.setTags(Arrays.asList("maths", "string theory", "video")); // A list of tags you want to use to describe your video.
videoCreationPayload.setMetadata(Collections.<Metadata>emptyList()); // A list of key value pairs that you use to provide metadata for your video. These pairs can be made dynamic, allowing you to segment your audience. You can also just use the pairs as another way to tag and categorize your videos.
try {
Video result = apiInstance.create(videoCreationPayload);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling VideosApi#create");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getMessage());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
- language: csharp
code: |
// First add the "ApiVideo" NuGet package to your project
// Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/PlayerThemesApi.md#create
using System.Diagnostics;
using ApiVideo.Client;
namespace Example
{
public class createExample
{
public static void Main()
{
var basePath = ApiVideoClient.Client.Environment.SANDBOX;
var apiKey = "YOUR_API_KEY";
var apiInstance = new ApiVideoClient(apiKey,basePath);
var playerThemeCreationPayload = new PlayerThemeCreationPayload(); // PlayerThemeCreationPayload |
var apiPlayerThemesInstance = apiInstance.PlayerThemes();
try
{
// Create a player
PlayerTheme result = apiPlayerThemesInstance.create(playerThemeCreationPayload);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PlayerThemesApi.create: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
- language: swift
code: |
// First install the api client: https://github.com/apivideo/api.video-ios-client#getting-started
// Documentation: https://github.com/apivideo/api.video-ios-client/blob/main/docs/VideosAPI.md#create
'/videos/{videoId}/source':
post:
tags:
- Videos
summary: Upload a video
description: Ingest a video from a source or file.
x-client-description:
default: |
To upload a video to the videoId you created. You can only upload your video to the videoId once.
We offer 2 types of upload:
* Regular upload
* Progressive upload
The latter allows you to split a video source into X chunks and send those chunks independently (concurrently or sequentially). The 2 main goals for our users are to
* allow the upload of video sources > 200 MiB (200 MiB = the max. allowed file size for regular upload)
* allow to send a video source "progressively", i.e., before before knowing the total size of the video.
Once all chunks have been sent, they are reaggregated to one source file. The video source is considered as "completely sent" when the "last" chunk is sent (i.e., the chunk that "completes" the upload).
operationId: POST_videos-videoId-source
parameters:
- name: videoId
in: path
description: Enter the videoId you want to use to upload your video.
required: true
style: simple
explode: false
schema:
type: string
example: vi4k0jvEUuaTdRAEjQ4Jfrgz
- name: Content-Range
in: header
required: false
style: simple
explode: false
schema:
pattern: '/(?:bytes (?<from>\d+)-(?<to>\d+)|part (?<part>\d+))\/(?<total>\d+|\*)/'
type: string
example: bytes 209715200-419430399/524288000 OR part 2/3
x-client-ignore: true
description: '`part <part>/<total_parts>` ; `bytes <from_byte>-<to_byte>/<total_bytes>`'
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/video-upload-payload'
responses:
'201':
description: Created
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/video'
examples:
response:
value:
videoId: vi4blUQJFrYWbaG44NChkH27
title: Maths video
description: An amazing video explaining the string theory.
public: false
panoramic: false
mp4Support: true
playerId: pl45KFKdlddgk654dspkze
tags:
- maths
- string theory
- video
metadata:
- key: Author
value: John Doe
- key: Format
value: Tutorial
publishedAt: '4665-07-14T23:36:18.598Z'
source:
uri: /videos/vi4blUQJFrYWbaG44NChkH27/source
assets:
iframe: '<iframe src="https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27" width="100%" height="100%" frameborder="0" scrolling="no" allowfullscreen=""></iframe>'
player: 'https://embed.api.video/vod/vi4blUQJFrYWbaG44NChkH27'
hls: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/hls/manifest.m3u8'
thumbnail: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/thumbnail.jpg'
mp4: 'https://cdn.api.video/vod/vi4blUQJFrYWbaG44NChkH27/mp4/source.mp4'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/bad-request'
examples:
response:
value:
type: 'https://docs.api.video/docs/filealreadyuploaded'
title: The source of the video is already uploaded.
name: file
status: 400
problems:
- type: 'https://docs.api.video/docs/filealreadyuploaded'
title: The source of the video is already uploaded.
name: file
- type: 'https://docs.api.video/docs/filealreadyuploaded'
title: The video xxxx has already been uploaded.
name: video
- type: 'https://docs.api.video/docs/filemissing'
title: There is no uploaded file in the request.
name: file
- type: 'https://docs.api.video/docs/multiplefilesuploaded'
title: There is more than one uploaded file in the request.
name: file
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/not-found'
examples:
response:
value:
type: 'https://docs.api.video/docs/resourcenot_found'
title: The requested resource was not found.
name: videoId
status: 404
security:
- apiKey: []
x-client-action: upload
x-client-chunk-upload: true
x-readme:
explorer-enabled: false
code-samples:
- language: go
code: |
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/VideosApi.md#upload
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
videoId := "vi4k0jvEUuaTdRAEjQ4Jfrgz"
// string | Enter the videoId you want to use to upload your video.
file := os.NewFile(1234, "some_file")
// *os.File | The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the "/videos" endpoint and add the "source" parameter when you create a new video.
res, err := client.Videos.UploadFile(videoId, file)
// you can also use a Reader instead of a File:
// client.Videos.Upload(videoId, fileName, fileReader, fileSize)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Videos.Upload``: %v\
", err)
}
// response from `Upload`: Video
fmt.Fprintf(os.Stdout, "Response from `Videos.Upload`: %v\
", res)
}
}
- language: node
code: |-
// First install the "@api.video/nodejs-client" npm package
// Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/VideosApi.md#upload
const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });
const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // Enter the videoId you want to use to upload your video.
const file = './my-video.mp4'; // The path to the video you would like to upload. The path must be local. If you want to use a video from an online source, you must use the "/videos" endpoint and add the "source" parameter when you create a new video.
const video = await client.videos.upload(videoId, file);
// if needed you can define an upload progress listener:
const video2 = await client.videos.upload(videoId, file, (event) => {
console.log("uploadedBytes: " + event.uploadedBytes);
console.log("totalBytes: " + event.totalBytes);
console.log("chunksCount: " + event.chunksCount);
console.log("currentChunk: " + event.currentChunk);
console.log("currentChunkTotalBytes: " + event.currentChunkTotalBytes);
console.log("currentChunkUploadedBytes: " + event.currentChunkUploadedBytes);
});
- language: php
code: |-
<?php
// First install the api client: "composer require api-video/php-api-client"
// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/VideosApi.md#upload
require __DIR__ . '/vendor/autoload.php';
$client = new \ApiVideo\Client\Client(
'https://ws.api.video',
'YOUR_API_KEY',
new \Symfony\Component\HttpClient\Psr18Client()
);
// create a new video & upload a video file
$myVideo = $client->videos()->create((new \ApiVideo\Client\Model\VideoCreationPayload())->setTitle('Uploaded video'));
$client->videos()->upload($myVideo->getVideoId(), new SplFileObject(__DIR__ . '/558k.mp4'));
// create a new video & upload a video file using progressive upload (the file is uploaded by parts)
$myVideo2 = $client->videos()->create((new \ApiVideo\Client\Model\VideoCreationPayload())->setTitle('Uploaded video (progressive upload)'));
$progressiveSession = $client->videos()->createUploadProgressiveSession($myVideo2->getVideoId());
$progressiveSession->uploadPart(new SplFileObject(__DIR__ . '/10m.mp4.part.a'));
$progressiveSession->uploadPart(new SplFileObject(__DIR__ . '/10m.mp4.part.b'));
$progressiveSession->uploadLastPart(new SplFileObject(__DIR__ . '/10m.mp4.part.c'));
- language: python
code: |
# First install the api client with "pip install api.video"
# Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/VideosApi.md#upload
import apivideo