forked from opentok/opentok-rtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.yml
510 lines (510 loc) · 14.9 KB
/
api.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
swagger: '2.0'
info:
title: OpenTokRTC API
description: >-
OpenTokRTC App, path and API description. TO-DO: Add here a general
description of the page navigation.
version: 1.0.0
host: opentokdemo.tokbox.com
schemes:
- https
basePath: /
consumes:
- application/x-www-form-urlencoded
- application/json
produces:
- application/json
- text/html
x-implementation-module: serverMethods.js
x-implementation-middleware:
- configReady
- oldVersionCompat
- iframingOptions
- featureEnabled
x-implementation-configuration: loadConfig
paths:
'/':
get:
summary: Gets the configured index page.
x-implemented-in: getRoot
produces:
- 'text/html'
description: >-
Returns a customized root page when the / is accessed.
responses:
'200':
description: The HTML for the root page
'/index.html':
get:
summary: Gets the configured index page.
x-implemented-in: getRoot
produces:
- 'text/html'
description: >-
Returns a customized root page when the / is accessed.
responses:
'200':
description: The HTML for the root page
'/room/{roomName}':
get:
summary: Connects to a new or existing room.
x-implemented-in: getRoom
produces:
- 'text/html,'
description: >-
Returns an HTML document that shows the defined UI for a chat 'room'
where the user may or may not have specified an identity. The document
returned will NOT have any of the information needed to connect to the
Tokbox servers already factored in. TO-DO: ¿Queremos que esto sea así o
que devolvamos ya todo configurado?
parameters:
- name: roomName
in: path
type: string
description: Name of the room.
required: true
- name: userName
description: Name/Id of the user that is connecting.
in: query
required: false
type: string
- name: template
description: Desired template.
in: query
required: false
type: string
tags:
- Rooms
responses:
'200':
description: The HTML for the room
schema:
$ref: '#/definitions/RoomHTML'
'400':
description: Unknown template
schema:
$ref: '#/definitions/ErrorInfo'
/updateArchiveInfo:
post:
summary: Callback for the OpenTok Archive API.
x-implemented-in: postUpdateArchiveInfo
description: Gets the updated information for a recording archive.
parameters:
- name: otArchiveInfo
in: body
schema:
$ref: '#/definitions/OTArchiveInfo'
tags:
- Archives
responses:
'200':
description: OK
'/room/{roomName}/info':
get:
summary: Information needed to connect to the TB servers.
x-implemented-in: getRoomInfo
produces:
- 'application/json,'
description: >-
Returns the information (sessionId, token, apiKey) that's required to
connect to an opentok session. The sessionId returned is specific for
the room, and the token MAY include information about the user that's
connecting (identified as anonymous if the user didn't specify a name).
Note that every time this URL is fetched a new token is created.
parameters:
- name: roomName
in: path
description: Name of the room.
required: true
type: string
- name: userName
in: query
description: Name of the user.
required: false
type: string
tags:
- Rooms
responses:
'200':
description: Information to connect to the room
schema:
$ref: '#/definitions/RoomInfo'
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
'/room/{roomName}/archive':
get:
summary: Last archive recorded of roomName
x-implemented-in: getRoomArchive
produces:
- text/html
description: >-
Returns the information of the last archive recorded (if it exists) of
the sessionId belonging to roomName
parameters:
- name: roomName
in: path
type: string
description: Name of the room
required: true
responses:
'200':
description: OK
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
'404':
description: Archive not found
schema:
$ref: '#/definitions/ErrorInfo'
post:
summary: Starts/stop an archiving operation.
x-implemented-in: postRoomArchive
consumes:
- application/x-www-form-urlencoded
produces:
- 'application/json,'
description: >-
Starts or stops an archiving operation. Returns the information about
the new recording, and inserts that information on the firebase record
associated to the room. Once a recording is in process, succesives call
with operation=start are ignored and the existing record of the current
archive is returned.
tags:
- Archives
parameters:
- name: roomName
in: path
description: Name of the room.
required: true
type: string
- name: userName
in: formData
description: Name of the user.
required: true
type: string
- name: operation
in: formData
description: Operation (startComposite/startIndividual/stop).
required: true
type: string
responses:
'200':
description: Information about the archive being recorded
schema:
$ref: '#/definitions/ArchiveInfo'
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
'/archive/{archiveId}':
get:
summary: Gets and returns a temporary archive URL.
x-implemented-in: getArchive
produces:
- application/json
description: >-
Creates a new temporary archive URL to allow the visualization or
download of an existing archive. The URL created is valid for 10 minutes
only! What this API actually does is just returning a 301 with the
actual download URL
tags:
- Archives
parameters:
- name: archiveId
in: path
description: Id of the archive.
required: true
type: string
- name: generatePreview
in: query
description: >-
If the parameter is present (the value is irrelevant) the server
should generate and return an HTML page that embeds the video
instead of returning the video directly.
required: false
type: string
responses:
'200':
description: HTML with the video embedded.
schema:
$ref: '#/definitions/ArchiveURL'
'301':
description: Information to download or view the archive file.
schema:
$ref: '#/definitions/ArchiveURL'
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
delete:
summary: Erases an archive.
x-implemented-in: deleteArchive
produces:
- application/json
description: Erases an stored archive.
tags:
- Archives
parameters:
- name: archiveId
in: path
description: Id of the archive.
required: true
type: string
responses:
'200':
description: Archive erases.
schema:
$ref: '#/definitions/ArchiveInfo'
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
'/room/{roomName}/dial':
post:
summary: Starts a SIP dial-out call
x-implemented-in: postRoomDial
consumes:
- application/json
produces:
- application/json
description: Starts dialing a phone via a SIP gatway.
tags:
- Dial
parameters:
- name: roomName
in: path
description: Name of the room.
required: true
type: string
- name: phoneNumber
in: body
description: The phone number to dial.
required: true
type: string
- name: googleIdToken
in: body
description: Authenticated google user token to be verified before call.
required: true
type: string
responses:
'200':
description: Information about the SIP call
schema:
$ref: '#/definitions/DialInfo'
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
'401':
description: Unauthorized, problem with authentication credentials.
'403':
description: Forbidden. Operation not valid for user token with this domain.
'/hang-up':
post:
summary: Call hang-up callback for web client (to disconnect SIP connection)
x-implemented-in: postHangUp
consumes:
- application/json
produces:
- application/json
description: Starts dialing a phone via a SIP gatway.
tags:
- Dial
parameters:
- phoneNumber: phoneNumber
in: body
description: The phone number for the connection to disconnect.
required: true
type: string
- name: googleIdToken
in: body
description: The google authentication token used to identify the client connecting.
required: true
type: string
responses:
'200':
description: Information about the SIP call
'400':
description: Unexpected error
schema:
$ref: '#/definitions/ErrorInfo'
'/server/health':
get:
summary: >-
A health check endpoint, reporting the ability of the app to connect to external services
x-implemented-in: getHealth
produces:
- application/json
description: Starts dialing a phone via a SIP gatway.
tags:
- Health
responses:
'200':
description: Passed health check
schema:
$ref: '#/definitions/HealthInfo'
'400':
description: Failed health check
schema:
$ref: '#/definitions/HealthInfo'
/saveConnection:
post:
summary: Callback to store a new connection in Firebase.
x-implemented-in: saveConnectionFirebase
description: Adds a new connection in the corresponding session in Firebase.
parameters:
- name: connection
in: body
description: The connection to be stored.
required: true
type: string
- name: sessionId
in: body
description: The sessionId of the connection.
required: true
type: string
tags:
- Firebase
responses:
'200':
description: OK
/deleteConnection:
post:
summary: Callback to delete a inactive connection from Firebase.
x-implemented-in: deleteConnectionFirebase
description: Deletes a connection in the corresponding session in Firebase.
parameters:
- name: connection
in: body
description: The connection to be deleted.
required: true
type: string
- name: sessionId
in: body
description: The sessionId of the connection.
required: true
type: string
tags:
- Firebase
responses:
'200':
description: OK
definitions:
RoomHTML:
type: string
description: HTML document of the room
RoomInfo:
type: object
properties:
sessionId:
type: string
apiKey:
type: string
token:
type: string
username:
type: string
firebaseURL:
type: string
firebaseToken:
type: string
ArchiveInfo:
type: object
properties:
archiveId:
type: string
archiveType:
type: string
ArchiveURL:
type: string
ErrorInfo:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string
OTArchiveInfo:
type: object
properties:
id:
description: Id of the updated archive
type: string
createdAt:
description: >-
The timestamp for when the archive started recording, expressed in
milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
type: string
duration:
description: >-
The duration of the archive in seconds. For archives that have are
being recorded (with the status property set "started"), this value is
set to 0.
type: string
name:
description: The name of the archive you supplied (this is optional)
type: string
partnerId:
description: Your OpenTok API key.
type: string
reason:
description: >-
For archives with the status "stopped", this can be set to "90 mins
exceeded", "failure", "session ended", "user initiated". For archives
with the status "failed", this can be set to "system failure".
type: string
sessionId:
description: The session ID of the OpenTok session that was archived.
type: string
size:
description: >-
The size of the archive file. For archives that have not been
generated, this value is set to 0.
type: string
status:
description: >-
The status of the archive. Only 'available' and 'uploaded' statuses
are actually processed.
type: string
url:
type: string
description: >-
The download URL of the available archive file. This is only set for
an archive with the status set to "available"; for other archives,
(including archives with the status "uploaded") this property is set
to null. The download URL is obfuscated, and the file is only
available from the URL for 10 minutes. To generate a new URL, use the
REST API for retrieving archive information or listing archives.
DialInfo:
type: object
properties:
id:
type: string
connectionId:
type: string
streamId:
type: string
HealthInfo:
type: object
properties:
name:
type: string
version:
type: string
gitHash:
type: string
opentok:
type: boolean
firebase:
type: boolean
googleAuth:
type: boolean
status:
type: string
enum: [pass, fail]