]>
Commit | Line | Data |
---|---|---|
3e9e6f2f | 1 | openapi: 3.0.0 |
1569a818 | 2 | info: |
5e1c08eb | 3 | title: PeerTube |
6cc98dff | 4 | version: 1.1.0-rc.1 |
2963c343 RK |
5 | contact: |
6 | name: PeerTube Community | |
7 | url: 'https://joinpeertube.org' | |
8 | license: | |
9 | name: AGPLv3.0 | |
10 | url: 'https://github.com/Chocobozzz/PeerTube/blob/master/LICENSE' | |
11 | x-logo: | |
12 | url: 'https://joinpeertube.org/img/brand.png' | |
5776f78e | 13 | altText: PeerTube Project Homepage |
2963c343 RK |
14 | description: | |
15 | # Introduction | |
16 | The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable | |
17 | resource URLs. It returns HTTP response codes to indicate errors. It also | |
18 | accepts and returns JSON in the HTTP body. You can use your favorite | |
19 | HTTP/REST library for your programming language to use PeerTube. No official | |
5776f78e RK |
20 | SDK is currently provided, but the spec API is fully compatible with |
21 | [openapi-generator](https://github.com/OpenAPITools/openapi-generator/wiki/API-client-generator-HOWTO) | |
22 | which generates a client SDK in the language of your choice. | |
3e9e6f2f | 23 | |
2963c343 RK |
24 | # Authentication |
25 | When you sign up for an account, you are given the possibility to generate | |
26 | sessions, and authenticate using this session token. One session token can | |
27 | currently be used at a time. | |
5776f78e RK |
28 | |
29 | # Errors | |
30 | The API uses standard HTTP status codes to indicate the success or failure | |
31 | of the API call. The body of the response will be JSON in the following | |
32 | format. | |
33 | ||
34 | ``` | |
35 | { | |
36 | "code": "unauthorized_request", // example inner error code | |
37 | "error": "Token is invalid." // example exposed error message | |
38 | } | |
39 | ``` | |
6441981b RK |
40 | externalDocs: |
41 | url: https://docs.joinpeertube.org/api.html | |
2963c343 RK |
42 | tags: |
43 | - name: Accounts | |
3e9e6f2f | 44 | description: > |
2963c343 | 45 | Using some features of PeerTube require authentication, for which Accounts |
3e9e6f2f | 46 | provide different levels of permission as well as associated user |
5776f78e | 47 | information. Accounts also encompass remote accounts discovered across the federation. |
2963c343 | 48 | - name: Config |
3e9e6f2f RK |
49 | description: > |
50 | Each server exposes public information regarding supported videos and | |
51 | options. | |
2963c343 RK |
52 | - name: Feeds |
53 | description: | | |
54 | Feeds of videos and feeds of comments allow to see updates and get them in | |
55 | an aggregator or script of your choice. | |
56 | - name: Job | |
3e9e6f2f RK |
57 | description: > |
58 | Jobs are long-running tasks enqueued and processed by the instance | |
5776f78e RK |
59 | itself. No additional worker registration is currently available. |
60 | - name: Server Following | |
3e9e6f2f RK |
61 | description: > |
62 | Managing servers which the instance interacts with is crucial to the | |
5776f78e RK |
63 | concept of federation in PeerTube and external video indexation. The PeerTube |
64 | server then deals with inter-server ActivityPub operations and propagates | |
2963c343 RK |
65 | information across its social graph by posting activities to actors' inbox |
66 | endpoints. | |
5776f78e | 67 | - name: Video Abuse |
2963c343 RK |
68 | description: | |
69 | Video abuses deal with reports of local or remote videos alike. | |
70 | - name: Video | |
71 | description: | | |
72 | Operations dealing with listing, uploading, fetching or modifying videos. | |
73 | - name: Search | |
74 | description: | | |
75 | The search helps to find _videos_ from within the instance and beyond. | |
76 | Videos from other instances federated by the instance (that is, instances | |
77 | followed by the instance) can be found via keywords and other criteria of | |
78 | the advanced search. | |
5776f78e | 79 | - name: Video Comment |
3e9e6f2f RK |
80 | description: > |
81 | Operations dealing with comments to a video. Comments are organized in | |
82 | threads. | |
5776f78e | 83 | - name: Video Channel |
3e9e6f2f RK |
84 | description: > |
85 | Operations dealing with creation, modification and video listing of a | |
5776f78e RK |
86 | user's channels. |
87 | - name: Video Blacklist | |
88 | description: > | |
89 | Operations dealing with blacklisting videos (removing them from view and | |
90 | preventing interactions). | |
91 | - name: Video Rate | |
92 | description: > | |
93 | Voting for a video. | |
94 | x-tagGroups: | |
95 | - name: Accounts | |
96 | tags: | |
97 | - Accounts | |
98 | - User | |
99 | - name: Videos | |
100 | tags: | |
101 | - Video | |
102 | - Video Channel | |
103 | - Video Comment | |
5776f78e RK |
104 | - Video Following |
105 | - Video Rate | |
106 | - name: Moderation | |
107 | tags: | |
9d0b856e | 108 | - Video Abuse |
5776f78e | 109 | - Video Blacklist |
65f02679 | 110 | - name: Instance Configuration |
5776f78e RK |
111 | tags: |
112 | - Config | |
113 | - Server Following | |
114 | - name: Notifications | |
115 | tags: | |
116 | - Feeds | |
117 | - name: Jobs | |
118 | tags: | |
119 | - Job | |
120 | - name: Search | |
121 | tags: | |
122 | - Search | |
1569a818 | 123 | paths: |
ad9e39fb | 124 | '/accounts/{name}': |
1569a818 DG |
125 | get: |
126 | tags: | |
127 | - Accounts | |
2963c343 | 128 | summary: Get the account by name |
1569a818 | 129 | parameters: |
3e9e6f2f RK |
130 | - $ref: '#/components/parameters/name' |
131 | - $ref: '#/components/parameters/start' | |
132 | - $ref: '#/components/parameters/count' | |
133 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
134 | responses: |
135 | '200': | |
136 | description: successful operation | |
3e9e6f2f RK |
137 | content: |
138 | application/json: | |
139 | schema: | |
140 | $ref: '#/components/schemas/Account' | |
ad9e39fb | 141 | '/accounts/{name}/videos': |
6b738c7a C |
142 | get: |
143 | tags: | |
144 | - Accounts | |
2963c343 | 145 | - Video |
3e9e6f2f | 146 | summary: 'Get videos for an account, provided the name of that account' |
6b738c7a | 147 | parameters: |
3e9e6f2f | 148 | - $ref: '#/components/parameters/name' |
6b738c7a C |
149 | responses: |
150 | '200': | |
151 | description: successful operation | |
3e9e6f2f RK |
152 | content: |
153 | application/json: | |
154 | schema: | |
155 | $ref: '#/components/schemas/Video' | |
2963c343 RK |
156 | x-code-samples: |
157 | - lang: JavaScript | |
158 | source: | | |
8f9e8be1 | 159 | fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos') |
2963c343 RK |
160 | .then(function(response) { |
161 | return response.json() | |
162 | }).then(function(data) { | |
163 | console.log(data) | |
164 | }) | |
8f9e8be1 RK |
165 | - lang: Shell |
166 | source: | | |
167 | # pip install httpie | |
168 | http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos | |
5776f78e RK |
169 | - lang: Ruby |
170 | source: | | |
171 | require 'uri' | |
172 | require 'net/http' | |
173 | ||
174 | url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos") | |
175 | ||
176 | http = Net::HTTP.new(url.host, url.port) | |
177 | http.use_ssl = true | |
178 | http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
179 | ||
180 | request = Net::HTTP::Post.new(url) | |
181 | request["content-type"] = 'application/json' | |
182 | response = http.request(request) | |
183 | puts response.read_body | |
184 | - lang: Python | |
185 | source: | | |
186 | import http.client | |
187 | ||
188 | conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1") | |
189 | ||
190 | headers = { | |
191 | 'content-type': "application/json" | |
192 | } | |
193 | ||
194 | conn.request("POST", "/accounts/{name}/videos", None, headers) | |
195 | ||
196 | res = conn.getresponse() | |
197 | data = res.read() | |
198 | ||
199 | print(data.decode("utf-8")) | |
1569a818 DG |
200 | /accounts: |
201 | get: | |
202 | tags: | |
203 | - Accounts | |
2963c343 | 204 | summary: Get all accounts |
1569a818 DG |
205 | responses: |
206 | '200': | |
207 | description: successful operation | |
3e9e6f2f | 208 | content: |
8f9e8be1 | 209 | 'application/json': |
3e9e6f2f RK |
210 | schema: |
211 | type: array | |
212 | items: | |
213 | $ref: '#/components/schemas/Account' | |
1569a818 DG |
214 | /config: |
215 | get: | |
216 | tags: | |
217 | - Config | |
6441981b | 218 | summary: Get the public configuration of the server |
1569a818 DG |
219 | responses: |
220 | '200': | |
221 | description: successful operation | |
3e9e6f2f RK |
222 | content: |
223 | application/json: | |
224 | schema: | |
225 | $ref: '#/components/schemas/ServerConfig' | |
6441981b RK |
226 | /config/about: |
227 | get: | |
228 | summary: Get the instance about page content | |
229 | tags: | |
230 | - Config | |
231 | responses: | |
232 | '200': | |
233 | description: successful operation | |
234 | /config/custom: | |
235 | get: | |
236 | summary: Get the runtime configuration of the server | |
237 | tags: | |
238 | - Config | |
239 | security: | |
240 | - OAuth2: | |
241 | - admin | |
242 | responses: | |
243 | '200': | |
244 | description: successful operation | |
245 | put: | |
246 | summary: Set the runtime configuration of the server | |
247 | tags: | |
248 | - Config | |
249 | security: | |
250 | - OAuth2: | |
251 | - admin | |
252 | responses: | |
253 | '200': | |
254 | description: successful operation | |
255 | delete: | |
256 | summary: Delete the runtime configuration of the server | |
257 | tags: | |
258 | - Config | |
259 | security: | |
260 | - OAuth2: | |
261 | - admin | |
262 | responses: | |
263 | '200': | |
264 | description: successful operation | |
3e9e6f2f | 265 | '/feeds/videos.{format}': |
244e76a5 | 266 | get: |
3e9e6f2f RK |
267 | summary: >- |
268 | Get the feed of videos for the server, with optional filter by account | |
269 | name or id | |
244e76a5 RK |
270 | tags: |
271 | - Feeds | |
244e76a5 RK |
272 | parameters: |
273 | - name: format | |
274 | in: path | |
275 | required: true | |
3e9e6f2f RK |
276 | description: >- |
277 | The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and | |
278 | json to JSON FEED 1.0 | |
279 | schema: | |
280 | type: string | |
281 | enum: | |
282 | - xml | |
283 | - atom | |
284 | - json | |
285 | default: xml | |
244e76a5 RK |
286 | - name: accountId |
287 | in: query | |
288 | required: false | |
3e9e6f2f RK |
289 | description: >- |
290 | The id of the local account to filter to (beware, users IDs and not | |
291 | actors IDs which will return empty feeds | |
292 | schema: | |
293 | type: number | |
244e76a5 RK |
294 | - name: accountName |
295 | in: query | |
296 | required: false | |
3e9e6f2f RK |
297 | description: The name of the local account to filter to |
298 | schema: | |
299 | type: string | |
244e76a5 RK |
300 | responses: |
301 | '200': | |
302 | description: successful operation | |
d216b538 | 303 | /jobs/{state}: |
1569a818 | 304 | get: |
2963c343 | 305 | summary: Get list of jobs |
94ff4c23 | 306 | security: |
3e9e6f2f RK |
307 | - OAuth2: |
308 | - admin | |
1569a818 DG |
309 | tags: |
310 | - Job | |
44cb3b85 DG |
311 | parameters: |
312 | - name: state | |
313 | in: path | |
314 | required: true | |
3e9e6f2f RK |
315 | description: The state of the job |
316 | schema: | |
317 | type: string | |
65f02679 RK |
318 | enum: |
319 | - active | |
320 | - completed | |
321 | - failed | |
322 | - waiting | |
323 | - delayed | |
3e9e6f2f RK |
324 | - $ref: '#/components/parameters/start' |
325 | - $ref: '#/components/parameters/count' | |
326 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
327 | responses: |
328 | '200': | |
329 | description: successful operation | |
3e9e6f2f RK |
330 | content: |
331 | application/json: | |
332 | schema: | |
333 | type: array | |
334 | items: | |
335 | $ref: '#/components/schemas/Job' | |
1569a818 DG |
336 | '/server/following/{host}': |
337 | delete: | |
94ff4c23 | 338 | security: |
3e9e6f2f RK |
339 | - OAuth2: |
340 | - admin | |
1569a818 | 341 | tags: |
5776f78e | 342 | - Server Following |
2963c343 | 343 | summary: Unfollow a server by hostname |
1569a818 DG |
344 | parameters: |
345 | - name: host | |
346 | in: path | |
347 | required: true | |
1569a818 | 348 | description: 'The host to unfollow ' |
3e9e6f2f RK |
349 | schema: |
350 | type: string | |
1569a818 DG |
351 | responses: |
352 | '201': | |
353 | description: successful operation | |
354 | /server/followers: | |
355 | get: | |
356 | tags: | |
5776f78e | 357 | - Server Following |
2963c343 | 358 | summary: Get followers of the server |
44cb3b85 | 359 | parameters: |
3e9e6f2f RK |
360 | - $ref: '#/components/parameters/start' |
361 | - $ref: '#/components/parameters/count' | |
362 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
363 | responses: |
364 | '200': | |
365 | description: successful operation | |
3e9e6f2f RK |
366 | content: |
367 | application/json: | |
368 | schema: | |
369 | type: array | |
370 | items: | |
371 | $ref: '#/components/schemas/Follow' | |
1569a818 DG |
372 | /server/following: |
373 | get: | |
374 | tags: | |
5776f78e | 375 | - Server Following |
2963c343 | 376 | summary: Get servers followed by the server |
44cb3b85 | 377 | parameters: |
3e9e6f2f RK |
378 | - $ref: '#/components/parameters/start' |
379 | - $ref: '#/components/parameters/count' | |
380 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
381 | responses: |
382 | '200': | |
383 | description: successful operation | |
3e9e6f2f RK |
384 | content: |
385 | application/json: | |
386 | schema: | |
387 | type: array | |
388 | items: | |
389 | $ref: '#/components/schemas/Follow' | |
1569a818 | 390 | post: |
94ff4c23 | 391 | security: |
3e9e6f2f RK |
392 | - OAuth2: |
393 | - admin | |
1569a818 | 394 | tags: |
5776f78e | 395 | - Server Following |
2963c343 | 396 | summary: Follow a server |
1569a818 DG |
397 | responses: |
398 | '204': | |
3e9e6f2f RK |
399 | $ref: '#/paths/~1users~1me/put/responses/204' |
400 | requestBody: | |
401 | content: | |
402 | application/json: | |
403 | schema: | |
404 | $ref: '#/components/schemas/Follow' | |
1569a818 DG |
405 | /users: |
406 | post: | |
2963c343 | 407 | summary: Creates user |
94ff4c23 | 408 | security: |
3e9e6f2f RK |
409 | - OAuth2: |
410 | - admin | |
1569a818 DG |
411 | tags: |
412 | - User | |
1569a818 DG |
413 | responses: |
414 | '200': | |
415 | description: successful operation | |
3e9e6f2f RK |
416 | content: |
417 | application/json: | |
418 | schema: | |
419 | $ref: '#/components/schemas/AddUserResponse' | |
420 | requestBody: | |
421 | content: | |
422 | application/json: | |
423 | schema: | |
424 | $ref: '#/components/schemas/AddUser' | |
425 | description: User to create | |
426 | required: true | |
1569a818 | 427 | get: |
2963c343 | 428 | summary: Get a list of users |
94ff4c23 | 429 | security: |
3e9e6f2f | 430 | - OAuth2: [] |
1569a818 DG |
431 | tags: |
432 | - User | |
44cb3b85 | 433 | parameters: |
3e9e6f2f RK |
434 | - $ref: '#/components/parameters/start' |
435 | - $ref: '#/components/parameters/count' | |
fd5af7a2 | 436 | - $ref: '#/components/parameters/usersSort' |
1569a818 DG |
437 | responses: |
438 | '200': | |
439 | description: successful operation | |
3e9e6f2f RK |
440 | content: |
441 | application/json: | |
442 | schema: | |
443 | type: array | |
444 | items: | |
445 | $ref: '#/components/schemas/User' | |
1569a818 DG |
446 | '/users/{id}': |
447 | delete: | |
2963c343 | 448 | summary: Delete a user by its id |
94ff4c23 | 449 | security: |
3e9e6f2f RK |
450 | - OAuth2: |
451 | - admin | |
1569a818 DG |
452 | tags: |
453 | - User | |
1569a818 | 454 | parameters: |
3e9e6f2f | 455 | - $ref: '#/components/parameters/id' |
1569a818 DG |
456 | responses: |
457 | '204': | |
3e9e6f2f | 458 | $ref: '#/paths/~1users~1me/put/responses/204' |
1569a818 | 459 | get: |
2963c343 | 460 | summary: Get user by its id |
94ff4c23 | 461 | security: |
3e9e6f2f | 462 | - OAuth2: [] |
1569a818 DG |
463 | tags: |
464 | - User | |
1569a818 | 465 | parameters: |
3e9e6f2f | 466 | - $ref: '#/components/parameters/id' |
1569a818 DG |
467 | responses: |
468 | '200': | |
469 | description: successful operation | |
3e9e6f2f RK |
470 | content: |
471 | application/json: | |
472 | schema: | |
473 | $ref: '#/components/schemas/User' | |
1569a818 | 474 | put: |
2963c343 | 475 | summary: Update user profile by its id |
94ff4c23 | 476 | security: |
3e9e6f2f | 477 | - OAuth2: [] |
1569a818 DG |
478 | tags: |
479 | - User | |
1569a818 | 480 | parameters: |
3e9e6f2f | 481 | - $ref: '#/components/parameters/id' |
1569a818 DG |
482 | responses: |
483 | '204': | |
3e9e6f2f RK |
484 | $ref: '#/paths/~1users~1me/put/responses/204' |
485 | requestBody: | |
486 | content: | |
487 | application/json: | |
488 | schema: | |
489 | $ref: '#/components/schemas/UpdateUser' | |
490 | required: true | |
1569a818 DG |
491 | /users/me: |
492 | get: | |
2963c343 | 493 | summary: Get current user information |
94ff4c23 | 494 | security: |
3e9e6f2f | 495 | - OAuth2: [] |
1569a818 DG |
496 | tags: |
497 | - User | |
1569a818 DG |
498 | responses: |
499 | '200': | |
500 | description: successful operation | |
3e9e6f2f RK |
501 | content: |
502 | application/json: | |
503 | schema: | |
504 | type: array | |
505 | items: | |
506 | $ref: '#/components/schemas/User' | |
1569a818 | 507 | put: |
2963c343 | 508 | summary: Update current user information |
94ff4c23 | 509 | security: |
3e9e6f2f | 510 | - OAuth2: [] |
1569a818 DG |
511 | tags: |
512 | - User | |
1569a818 DG |
513 | responses: |
514 | '204': | |
3e9e6f2f RK |
515 | description: Successful operation |
516 | requestBody: | |
517 | content: | |
518 | application/json: | |
519 | schema: | |
520 | $ref: '#/components/schemas/UpdateMe' | |
521 | required: true | |
1569a818 DG |
522 | /users/me/video-quota-used: |
523 | get: | |
2963c343 | 524 | summary: Get current user used quota |
94ff4c23 | 525 | security: |
3e9e6f2f | 526 | - OAuth2: [] |
1569a818 DG |
527 | tags: |
528 | - User | |
1569a818 DG |
529 | responses: |
530 | '200': | |
531 | description: successful operation | |
3e9e6f2f RK |
532 | content: |
533 | application/json: | |
534 | schema: | |
535 | type: number | |
1569a818 DG |
536 | '/users/me/videos/{videoId}/rating': |
537 | get: | |
3e9e6f2f | 538 | summary: 'Get rating of video by its id, among those of the current user' |
94ff4c23 | 539 | security: |
3e9e6f2f | 540 | - OAuth2: [] |
1569a818 DG |
541 | tags: |
542 | - User | |
1569a818 DG |
543 | parameters: |
544 | - name: videoId | |
545 | in: path | |
546 | required: true | |
1569a818 | 547 | description: 'The video id ' |
3e9e6f2f RK |
548 | schema: |
549 | type: string | |
1569a818 DG |
550 | responses: |
551 | '200': | |
552 | description: successful operation | |
3e9e6f2f RK |
553 | content: |
554 | application/json: | |
555 | schema: | |
556 | $ref: '#/components/schemas/GetMeVideoRating' | |
1569a818 DG |
557 | /users/me/videos: |
558 | get: | |
2963c343 | 559 | summary: Get videos of the current user |
94ff4c23 | 560 | security: |
3e9e6f2f | 561 | - OAuth2: [] |
1569a818 DG |
562 | tags: |
563 | - User | |
44cb3b85 | 564 | parameters: |
3e9e6f2f RK |
565 | - $ref: '#/components/parameters/start' |
566 | - $ref: '#/components/parameters/count' | |
567 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
568 | responses: |
569 | '200': | |
570 | description: successful operation | |
3e9e6f2f RK |
571 | content: |
572 | application/json: | |
573 | schema: | |
574 | type: array | |
575 | items: | |
576 | $ref: '#/components/schemas/Video' | |
1569a818 DG |
577 | /users/register: |
578 | post: | |
2963c343 | 579 | summary: Register a user |
1569a818 DG |
580 | tags: |
581 | - User | |
1569a818 DG |
582 | responses: |
583 | '204': | |
3e9e6f2f RK |
584 | $ref: '#/paths/~1users~1me/put/responses/204' |
585 | requestBody: | |
586 | content: | |
587 | application/json: | |
588 | schema: | |
589 | $ref: '#/components/schemas/RegisterUser' | |
590 | required: true | |
1569a818 DG |
591 | /users/me/avatar/pick: |
592 | post: | |
2963c343 | 593 | summary: Update current user avatar |
94ff4c23 | 594 | security: |
3e9e6f2f | 595 | - OAuth2: [] |
1569a818 DG |
596 | tags: |
597 | - User | |
1569a818 DG |
598 | responses: |
599 | '200': | |
600 | description: successful operation | |
3e9e6f2f RK |
601 | content: |
602 | application/json: | |
603 | schema: | |
604 | $ref: '#/components/schemas/Avatar' | |
605 | requestBody: | |
606 | content: | |
607 | multipart/form-data: | |
608 | schema: | |
609 | type: object | |
610 | properties: | |
611 | avatarfile: | |
612 | description: The file to upload. | |
613 | type: string | |
614 | format: binary | |
615 | encoding: | |
616 | profileImage: | |
617 | # only accept png/jpeg | |
618 | contentType: image/png, image/jpeg | |
c360c494 | 619 | /videos: |
1569a818 | 620 | get: |
2963c343 | 621 | summary: Get list of videos |
1569a818 DG |
622 | tags: |
623 | - Video | |
44cb3b85 | 624 | parameters: |
fd5af7a2 RK |
625 | - $ref: '#/components/parameters/categoryOneOf' |
626 | - $ref: '#/components/parameters/tagsOneOf' | |
627 | - $ref: '#/components/parameters/tagsAllOf' | |
628 | - $ref: '#/components/parameters/licenceOneOf' | |
629 | - $ref: '#/components/parameters/languageOneOf' | |
630 | - $ref: '#/components/parameters/nsfw' | |
631 | - $ref: '#/components/parameters/filter' | |
3e9e6f2f RK |
632 | - $ref: '#/components/parameters/start' |
633 | - $ref: '#/components/parameters/count' | |
fd5af7a2 | 634 | - $ref: '#/components/parameters/videosSort' |
1569a818 DG |
635 | responses: |
636 | '200': | |
637 | description: successful operation | |
3e9e6f2f RK |
638 | content: |
639 | application/json: | |
640 | schema: | |
641 | type: array | |
642 | items: | |
643 | $ref: '#/components/schemas/Video' | |
c360c494 | 644 | /videos/categories: |
1569a818 | 645 | get: |
2963c343 | 646 | summary: Get list of video licences known by the server |
1569a818 DG |
647 | tags: |
648 | - Video | |
1569a818 DG |
649 | responses: |
650 | '200': | |
651 | description: successful operation | |
3e9e6f2f RK |
652 | content: |
653 | application/json: | |
654 | schema: | |
655 | type: array | |
656 | items: | |
657 | type: string | |
c360c494 | 658 | /videos/licences: |
1569a818 | 659 | get: |
2963c343 | 660 | summary: Get list of video licences known by the server |
1569a818 DG |
661 | tags: |
662 | - Video | |
1569a818 DG |
663 | responses: |
664 | '200': | |
665 | description: successful operation | |
3e9e6f2f RK |
666 | content: |
667 | application/json: | |
668 | schema: | |
669 | type: array | |
670 | items: | |
671 | type: string | |
c360c494 | 672 | /videos/languages: |
1569a818 | 673 | get: |
2963c343 | 674 | summary: Get list of languages known by the server |
1569a818 DG |
675 | tags: |
676 | - Video | |
1569a818 DG |
677 | responses: |
678 | '200': | |
679 | description: successful operation | |
3e9e6f2f RK |
680 | content: |
681 | application/json: | |
682 | schema: | |
683 | type: array | |
684 | items: | |
685 | type: string | |
c360c494 | 686 | /videos/privacies: |
1569a818 | 687 | get: |
2963c343 | 688 | summary: Get list of privacy policies supported by the server |
1569a818 DG |
689 | tags: |
690 | - Video | |
1569a818 DG |
691 | responses: |
692 | '200': | |
693 | description: successful operation | |
3e9e6f2f RK |
694 | content: |
695 | application/json: | |
696 | schema: | |
697 | type: array | |
698 | items: | |
699 | type: string | |
700 | '/videos/{id}': | |
1569a818 | 701 | put: |
2963c343 | 702 | summary: Update metadata for a video by its id |
94ff4c23 | 703 | security: |
3e9e6f2f | 704 | - OAuth2: [] |
1569a818 DG |
705 | tags: |
706 | - Video | |
1569a818 | 707 | parameters: |
3e9e6f2f | 708 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
709 | responses: |
710 | '200': | |
711 | description: successful operation | |
3e9e6f2f RK |
712 | content: |
713 | application/json: | |
714 | schema: | |
715 | $ref: '#/components/schemas/Video' | |
716 | requestBody: | |
717 | content: | |
718 | multipart/form-data: | |
719 | schema: | |
720 | type: object | |
721 | properties: | |
722 | thumbnailfile: | |
723 | description: Video thumbnail file | |
724 | type: string | |
725 | previewfile: | |
726 | description: Video preview file | |
727 | type: string | |
728 | category: | |
729 | description: Video category | |
730 | type: string | |
731 | licence: | |
732 | description: Video licence | |
733 | type: string | |
734 | language: | |
735 | description: Video language | |
736 | type: string | |
737 | description: | |
738 | description: Video description | |
739 | type: string | |
740 | waitTranscoding: | |
741 | description: Whether or not we wait transcoding before publish the video | |
742 | type: string | |
743 | support: | |
744 | description: Text describing how to support the video uploader | |
745 | type: string | |
746 | nsfw: | |
747 | description: Whether or not this video contains sensitive content | |
748 | type: string | |
749 | name: | |
750 | description: Video name | |
751 | type: string | |
752 | tags: | |
753 | description: Video tags | |
754 | type: string | |
755 | commentsEnabled: | |
756 | description: Enable or disable comments for this video | |
757 | type: string | |
758 | scheduleUpdate: &ref_0 | |
759 | type: object | |
760 | properties: | |
761 | privacy: | |
762 | type: string | |
763 | enum: | |
764 | - Public | |
765 | - Unlisted | |
766 | description: Video privacy target | |
767 | updateAt: | |
768 | type: string | |
769 | format: date | |
770 | description: When to update the video | |
771 | required: | |
772 | - updateAt | |
1569a818 | 773 | get: |
2963c343 | 774 | summary: Get a video by its id |
1569a818 DG |
775 | tags: |
776 | - Video | |
1569a818 | 777 | parameters: |
3e9e6f2f | 778 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
779 | responses: |
780 | '200': | |
781 | description: successful operation | |
3e9e6f2f RK |
782 | content: |
783 | application/json: | |
784 | schema: | |
785 | $ref: '#/components/schemas/Video' | |
1569a818 | 786 | delete: |
2963c343 | 787 | summary: Delete a video by its id |
94ff4c23 | 788 | security: |
3e9e6f2f | 789 | - OAuth2: [] |
1569a818 DG |
790 | tags: |
791 | - Video | |
1569a818 | 792 | parameters: |
3e9e6f2f | 793 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
794 | responses: |
795 | '204': | |
3e9e6f2f RK |
796 | $ref: '#/paths/~1users~1me/put/responses/204' |
797 | '/videos/{id}/description': | |
1569a818 | 798 | get: |
2963c343 | 799 | summary: Get a video description by its id |
1569a818 DG |
800 | tags: |
801 | - Video | |
1569a818 | 802 | parameters: |
3e9e6f2f | 803 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
804 | responses: |
805 | '200': | |
806 | description: successful operation | |
3e9e6f2f RK |
807 | content: |
808 | application/json: | |
809 | schema: | |
810 | type: string | |
811 | '/videos/{id}/views': | |
1569a818 | 812 | post: |
2963c343 | 813 | summary: Add a view to the video by its id |
1569a818 DG |
814 | tags: |
815 | - Video | |
1569a818 | 816 | parameters: |
3e9e6f2f | 817 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
818 | responses: |
819 | '204': | |
3e9e6f2f | 820 | $ref: '#/paths/~1users~1me/put/responses/204' |
6441981b RK |
821 | '/videos/{id}/watching': |
822 | put: | |
823 | summary: Indicate progress of in watching the video by its id for a user | |
824 | tags: | |
825 | - Video | |
826 | security: | |
827 | - OAuth2: [] | |
828 | parameters: | |
829 | - $ref: '#/components/parameters/id2' | |
830 | requestBody: | |
831 | content: | |
832 | application/json: | |
833 | schema: | |
834 | $ref: '#/components/schemas/UserWatchingVideo' | |
835 | required: true | |
836 | responses: | |
837 | '204': | |
838 | $ref: '#/paths/~1users~1me/put/responses/204' | |
839 | /videos/ownership: | |
840 | get: | |
841 | summary: Get list of video ownership changes requests | |
842 | tags: | |
843 | - Video | |
844 | security: | |
845 | - OAuth2: [] | |
846 | parameters: | |
847 | - $ref: '#/components/parameters/id2' | |
848 | responses: | |
849 | '200': | |
850 | description: successful operation | |
851 | '/videos/ownership/{id}/accept': | |
852 | post: | |
853 | summary: Refuse ownership change request for video by its id | |
854 | tags: | |
855 | - Video | |
856 | security: | |
857 | - OAuth2: [] | |
858 | parameters: | |
859 | - $ref: '#/components/parameters/id2' | |
860 | responses: | |
861 | '204': | |
862 | $ref: '#/paths/~1users~1me/put/responses/204' | |
863 | '/videos/ownership/{id}/refuse': | |
864 | post: | |
865 | summary: Accept ownership change request for video by its id | |
866 | tags: | |
867 | - Video | |
868 | security: | |
869 | - OAuth2: [] | |
870 | parameters: | |
871 | - $ref: '#/components/parameters/id2' | |
872 | responses: | |
873 | '204': | |
874 | $ref: '#/paths/~1users~1me/put/responses/204' | |
875 | '/videos/{id}/give-ownership': | |
876 | post: | |
877 | summary: Request change of ownership for a video you own, by its id | |
878 | tags: | |
879 | - Video | |
880 | security: | |
881 | - OAuth2: [] | |
882 | parameters: | |
883 | - $ref: '#/components/parameters/id2' | |
884 | requestBody: | |
885 | required: true | |
886 | content: | |
887 | application/x-www-form-urlencoded: | |
888 | schema: | |
889 | type: object | |
890 | properties: | |
891 | username: | |
892 | type: string | |
893 | required: | |
894 | - username | |
895 | responses: | |
896 | '204': | |
897 | $ref: '#/paths/~1users~1me/put/responses/204' | |
898 | '400': | |
899 | description: 'Changing video ownership to a remote account is not supported yet' | |
c360c494 | 900 | /videos/upload: |
1569a818 | 901 | post: |
2963c343 | 902 | summary: Upload a video file with its metadata |
94ff4c23 | 903 | security: |
3e9e6f2f | 904 | - OAuth2: [] |
1569a818 DG |
905 | tags: |
906 | - Video | |
1569a818 DG |
907 | responses: |
908 | '200': | |
909 | description: successful operation | |
3e9e6f2f RK |
910 | content: |
911 | application/json: | |
912 | schema: | |
913 | $ref: '#/components/schemas/VideoUploadResponse' | |
914 | requestBody: | |
915 | content: | |
916 | multipart/form-data: | |
917 | schema: | |
918 | type: object | |
919 | properties: | |
920 | videofile: | |
921 | description: Video file | |
922 | type: string | |
923 | format: binary | |
924 | channelId: | |
925 | description: Channel id that will contain this video | |
926 | type: number | |
927 | thumbnailfile: | |
928 | description: Video thumbnail file | |
929 | type: string | |
930 | previewfile: | |
931 | description: Video preview file | |
932 | type: string | |
8f9e8be1 RK |
933 | privacy: |
934 | $ref: '#/components/schemas/VideoPrivacy' | |
3e9e6f2f RK |
935 | category: |
936 | description: Video category | |
937 | type: string | |
938 | licence: | |
939 | description: Video licence | |
940 | type: string | |
941 | language: | |
942 | description: Video language | |
943 | type: string | |
944 | description: | |
945 | description: Video description | |
946 | type: string | |
947 | waitTranscoding: | |
948 | description: Whether or not we wait transcoding before publish the video | |
949 | type: string | |
950 | support: | |
951 | description: Text describing how to support the video uploader | |
952 | type: string | |
953 | nsfw: | |
954 | description: Whether or not this video contains sensitive content | |
955 | type: string | |
956 | name: | |
957 | description: Video name | |
958 | type: string | |
959 | tags: | |
960 | description: Video tags | |
961 | type: string | |
962 | commentsEnabled: | |
963 | description: Enable or disable comments for this video | |
964 | type: string | |
965 | scheduleUpdate: *ref_0 | |
966 | required: | |
967 | - videofile | |
968 | - channelId | |
8f9e8be1 | 969 | - name |
8f9e8be1 RK |
970 | x-code-samples: |
971 | - lang: Shell | |
972 | source: | | |
973 | ## DEPENDENCIES: httpie, jq | |
974 | # pip install httpie | |
975 | USERNAME="<your_username>" | |
976 | PASSWORD="<your_password>" | |
977 | FILE_PATH="<your_file_path>" | |
978 | CHANNEL_ID="<your_channel_id>" | |
8f9e8be1 RK |
979 | NAME="<video_name>" |
980 | ||
981 | API_PATH="https://peertube2.cpy.re/api/v1" | |
982 | ## AUTH | |
983 | client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id") | |
984 | client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret") | |
985 | token=$(http -b --form POST "$API_PATH/users/token" \ | |
986 | client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \ | |
987 | username=$USERNAME \ | |
988 | password=$PASSWORD \ | |
989 | | jq -r ".access_token") | |
990 | ## VIDEO UPLOAD | |
991 | http -b --form POST "$API_PATH/videos/upload" \ | |
992 | videofile@$FILE_PATH \ | |
993 | channelId=$CHANNEL_ID \ | |
994 | name=$NAME \ | |
8f9e8be1 | 995 | "Authorization:Bearer $token" |
c360c494 | 996 | /videos/abuse: |
1569a818 | 997 | get: |
2963c343 | 998 | summary: Get list of reported video abuses |
94ff4c23 | 999 | security: |
3e9e6f2f | 1000 | - OAuth2: [] |
1569a818 | 1001 | tags: |
5776f78e | 1002 | - Video Abuse |
44cb3b85 | 1003 | parameters: |
3e9e6f2f RK |
1004 | - $ref: '#/components/parameters/start' |
1005 | - $ref: '#/components/parameters/count' | |
fd5af7a2 | 1006 | - $ref: '#/components/parameters/abusesSort' |
1569a818 DG |
1007 | responses: |
1008 | '200': | |
1009 | description: successful operation | |
3e9e6f2f RK |
1010 | content: |
1011 | application/json: | |
1012 | schema: | |
1013 | type: array | |
1014 | items: | |
1015 | $ref: '#/components/schemas/VideoAbuse' | |
1016 | '/videos/{id}/abuse': | |
1569a818 | 1017 | post: |
3e9e6f2f | 1018 | summary: 'Report an abuse, on a video by its id' |
94ff4c23 | 1019 | security: |
3e9e6f2f | 1020 | - OAuth2: [] |
1569a818 | 1021 | tags: |
5776f78e | 1022 | - Video Abuse |
1569a818 | 1023 | parameters: |
3e9e6f2f | 1024 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
1025 | responses: |
1026 | '204': | |
3e9e6f2f RK |
1027 | $ref: '#/paths/~1users~1me/put/responses/204' |
1028 | '/videos/{id}/blacklist': | |
1569a818 | 1029 | post: |
2963c343 | 1030 | summary: Put on blacklist a video by its id |
94ff4c23 | 1031 | security: |
3e9e6f2f RK |
1032 | - OAuth2: |
1033 | - admin | |
1034 | - moderator | |
1569a818 | 1035 | tags: |
5776f78e | 1036 | - Video Blacklist |
1569a818 | 1037 | parameters: |
3e9e6f2f | 1038 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
1039 | responses: |
1040 | '204': | |
3e9e6f2f | 1041 | $ref: '#/paths/~1users~1me/put/responses/204' |
1569a818 | 1042 | delete: |
2963c343 | 1043 | summary: Delete an entry of the blacklist of a video by its id |
94ff4c23 | 1044 | security: |
3e9e6f2f RK |
1045 | - OAuth2: |
1046 | - admin | |
1047 | - moderator | |
1569a818 | 1048 | tags: |
5776f78e | 1049 | - Video Blacklist |
1569a818 | 1050 | parameters: |
3e9e6f2f | 1051 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
1052 | responses: |
1053 | '204': | |
3e9e6f2f | 1054 | $ref: '#/paths/~1users~1me/put/responses/204' |
c360c494 | 1055 | /videos/blacklist: |
1569a818 | 1056 | get: |
2963c343 | 1057 | summary: Get list of videos on blacklist |
94ff4c23 | 1058 | security: |
3e9e6f2f RK |
1059 | - OAuth2: |
1060 | - admin | |
1061 | - moderator | |
1569a818 | 1062 | tags: |
5776f78e | 1063 | - Video Blacklist |
44cb3b85 | 1064 | parameters: |
3e9e6f2f RK |
1065 | - $ref: '#/components/parameters/start' |
1066 | - $ref: '#/components/parameters/count' | |
fd5af7a2 | 1067 | - $ref: '#/components/parameters/blacklistsSort' |
1569a818 DG |
1068 | responses: |
1069 | '200': | |
1070 | description: successful operation | |
3e9e6f2f RK |
1071 | content: |
1072 | application/json: | |
1073 | schema: | |
1074 | type: array | |
1075 | items: | |
1076 | $ref: '#/components/schemas/VideoBlacklist' | |
48dce1c9 | 1077 | /video-channels: |
1569a818 | 1078 | get: |
2963c343 | 1079 | summary: Get list of video channels |
1569a818 | 1080 | tags: |
5776f78e | 1081 | - Video Channel |
44cb3b85 | 1082 | parameters: |
3e9e6f2f RK |
1083 | - $ref: '#/components/parameters/start' |
1084 | - $ref: '#/components/parameters/count' | |
1085 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
1086 | responses: |
1087 | '200': | |
1088 | description: successful operation | |
3e9e6f2f RK |
1089 | content: |
1090 | application/json: | |
1091 | schema: | |
1092 | type: array | |
1093 | items: | |
1094 | $ref: '#/components/schemas/VideoChannel' | |
1569a818 | 1095 | post: |
2963c343 | 1096 | summary: Creates a video channel for the current user |
94ff4c23 | 1097 | security: |
3e9e6f2f | 1098 | - OAuth2: [] |
1569a818 | 1099 | tags: |
5776f78e | 1100 | - Video Channel |
1569a818 DG |
1101 | responses: |
1102 | '204': | |
3e9e6f2f RK |
1103 | $ref: '#/paths/~1users~1me/put/responses/204' |
1104 | requestBody: | |
1105 | $ref: '#/components/requestBodies/VideoChannelInput' | |
1106 | '/video-channels/{id}': | |
1569a818 | 1107 | get: |
2963c343 | 1108 | summary: Get a video channel by its id |
1569a818 | 1109 | tags: |
5776f78e | 1110 | - Video Channel |
1569a818 | 1111 | parameters: |
3e9e6f2f | 1112 | - $ref: '#/components/parameters/id3' |
1569a818 DG |
1113 | responses: |
1114 | '200': | |
1115 | description: successful operation | |
3e9e6f2f RK |
1116 | content: |
1117 | application/json: | |
1118 | schema: | |
1119 | $ref: '#/components/schemas/VideoChannel' | |
1569a818 | 1120 | put: |
2963c343 | 1121 | summary: Update a video channel by its id |
94ff4c23 | 1122 | security: |
3e9e6f2f | 1123 | - OAuth2: [] |
1569a818 | 1124 | tags: |
5776f78e | 1125 | - Video Channel |
1569a818 | 1126 | parameters: |
3e9e6f2f | 1127 | - $ref: '#/components/parameters/id3' |
1569a818 DG |
1128 | responses: |
1129 | '204': | |
3e9e6f2f RK |
1130 | $ref: '#/paths/~1users~1me/put/responses/204' |
1131 | requestBody: | |
1132 | $ref: '#/components/requestBodies/VideoChannelInput' | |
1569a818 | 1133 | delete: |
2963c343 | 1134 | summary: Delete a video channel by its id |
94ff4c23 | 1135 | security: |
3e9e6f2f | 1136 | - OAuth2: [] |
1569a818 | 1137 | tags: |
5776f78e | 1138 | - Video Channel |
1569a818 | 1139 | parameters: |
3e9e6f2f | 1140 | - $ref: '#/components/parameters/id3' |
cc918ac3 C |
1141 | responses: |
1142 | '204': | |
3e9e6f2f RK |
1143 | $ref: '#/paths/~1users~1me/put/responses/204' |
1144 | '/video-channels/{id}/videos': | |
cc918ac3 | 1145 | get: |
2963c343 | 1146 | summary: Get videos of a video channel by its id |
cc918ac3 | 1147 | tags: |
5776f78e | 1148 | - Video Channel |
cc918ac3 | 1149 | parameters: |
3e9e6f2f | 1150 | - $ref: '#/components/parameters/id3' |
1569a818 | 1151 | responses: |
cc918ac3 | 1152 | '200': |
1569a818 | 1153 | description: successful operation |
3e9e6f2f RK |
1154 | content: |
1155 | application/json: | |
1156 | schema: | |
1157 | $ref: '#/components/schemas/Video' | |
1158 | '/accounts/{name}/video-channels': | |
6b738c7a | 1159 | get: |
2963c343 | 1160 | summary: Get video channels of an account by its name |
6b738c7a | 1161 | tags: |
5776f78e | 1162 | - Video Channel |
6b738c7a | 1163 | parameters: |
3e9e6f2f | 1164 | - $ref: '#/components/parameters/name' |
6b738c7a C |
1165 | responses: |
1166 | '200': | |
1167 | description: successful operation | |
3e9e6f2f RK |
1168 | content: |
1169 | application/json: | |
1170 | schema: | |
1171 | type: array | |
1172 | items: | |
1173 | $ref: '#/components/schemas/VideoChannel' | |
1174 | '/videos/{id}/comment-threads': | |
1569a818 | 1175 | get: |
2963c343 | 1176 | summary: Get the comment threads of a video by its id |
1569a818 | 1177 | tags: |
5776f78e | 1178 | - Video Comment |
1569a818 | 1179 | parameters: |
3e9e6f2f RK |
1180 | - $ref: '#/components/parameters/id2' |
1181 | - $ref: '#/components/parameters/start' | |
1182 | - $ref: '#/components/parameters/count' | |
1183 | - $ref: '#/components/parameters/sort' | |
1569a818 DG |
1184 | responses: |
1185 | '200': | |
1186 | description: successful operation | |
3e9e6f2f RK |
1187 | content: |
1188 | application/json: | |
1189 | schema: | |
1190 | $ref: '#/components/schemas/CommentThreadResponse' | |
1569a818 | 1191 | post: |
3e9e6f2f | 1192 | summary: 'Creates a comment thread, on a video by its id' |
94ff4c23 | 1193 | security: |
3e9e6f2f | 1194 | - OAuth2: [] |
1569a818 | 1195 | tags: |
5776f78e | 1196 | - Video Comment |
1569a818 | 1197 | parameters: |
3e9e6f2f | 1198 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
1199 | responses: |
1200 | '200': | |
1201 | description: successful operation | |
3e9e6f2f RK |
1202 | content: |
1203 | application/json: | |
1204 | schema: | |
1205 | $ref: '#/components/schemas/CommentThreadPostResponse' | |
1206 | '/videos/{id}/comment-threads/{threadId}': | |
1569a818 | 1207 | get: |
3e9e6f2f | 1208 | summary: 'Get the comment thread by its id, of a video by its id' |
1569a818 | 1209 | tags: |
5776f78e | 1210 | - Video Comment |
1569a818 | 1211 | parameters: |
3e9e6f2f RK |
1212 | - $ref: '#/components/parameters/id2' |
1213 | - name: threadId | |
1214 | in: path | |
1215 | required: true | |
1216 | description: The thread id (root comment id) | |
1217 | schema: | |
1218 | type: number | |
1569a818 DG |
1219 | responses: |
1220 | '200': | |
1221 | description: successful operation | |
3e9e6f2f RK |
1222 | content: |
1223 | application/json: | |
1224 | schema: | |
1225 | $ref: '#/components/schemas/VideoCommentThreadTree' | |
1226 | '/videos/{id}/comments/{commentId}': | |
1569a818 | 1227 | post: |
3e9e6f2f | 1228 | summary: 'Creates a comment in a comment thread by its id, of a video by its id' |
94ff4c23 | 1229 | security: |
3e9e6f2f | 1230 | - OAuth2: [] |
1569a818 | 1231 | tags: |
5776f78e | 1232 | - Video Comment |
1569a818 | 1233 | parameters: |
3e9e6f2f RK |
1234 | - $ref: '#/components/parameters/id2' |
1235 | - $ref: '#/components/parameters/commentId' | |
1569a818 DG |
1236 | responses: |
1237 | '200': | |
1238 | description: successful operation | |
3e9e6f2f RK |
1239 | content: |
1240 | application/json: | |
1241 | schema: | |
1242 | $ref: '#/components/schemas/CommentThreadPostResponse' | |
1569a818 | 1243 | delete: |
3e9e6f2f | 1244 | summary: 'Delete a comment in a comment therad by its id, of a video by its id' |
94ff4c23 | 1245 | security: |
3e9e6f2f | 1246 | - OAuth2: [] |
1569a818 | 1247 | tags: |
5776f78e | 1248 | - Video Comment |
1569a818 | 1249 | parameters: |
3e9e6f2f RK |
1250 | - $ref: '#/components/parameters/id2' |
1251 | - $ref: '#/components/parameters/commentId' | |
1569a818 DG |
1252 | responses: |
1253 | '204': | |
3e9e6f2f RK |
1254 | $ref: '#/paths/~1users~1me/put/responses/204' |
1255 | '/videos/{id}/rate': | |
1569a818 | 1256 | put: |
2963c343 | 1257 | summary: Vote for a video by its id |
94ff4c23 | 1258 | security: |
3e9e6f2f | 1259 | - OAuth2: [] |
1569a818 | 1260 | tags: |
5776f78e | 1261 | - Video Rate |
1569a818 | 1262 | parameters: |
3e9e6f2f | 1263 | - $ref: '#/components/parameters/id2' |
1569a818 DG |
1264 | responses: |
1265 | '204': | |
3e9e6f2f | 1266 | $ref: '#/paths/~1users~1me/put/responses/204' |
fb72c193 DL |
1267 | /search/videos: |
1268 | get: | |
1269 | tags: | |
1270 | - Search | |
2963c343 | 1271 | summary: Get the videos corresponding to a given query |
fb72c193 | 1272 | parameters: |
3e9e6f2f RK |
1273 | - $ref: '#/components/parameters/start' |
1274 | - $ref: '#/components/parameters/count' | |
fd5af7a2 | 1275 | - $ref: '#/components/parameters/videosSearchSort' |
655b5490 | 1276 | - name: search |
fb72c193 DL |
1277 | in: query |
1278 | required: true | |
3e9e6f2f RK |
1279 | description: String to search |
1280 | schema: | |
1281 | type: string | |
fb72c193 DL |
1282 | responses: |
1283 | '200': | |
1284 | description: successful operation | |
3e9e6f2f RK |
1285 | content: |
1286 | application/json: | |
1287 | schema: | |
1569a818 DG |
1288 | type: array |
1289 | items: | |
3e9e6f2f RK |
1290 | $ref: '#/components/schemas/Video' |
1291 | servers: | |
6441981b RK |
1292 | - url: 'https://peertube.cpy.re/api/v1' |
1293 | description: Live Test Server (live data - stable version) | |
8f9e8be1 | 1294 | - url: 'https://peertube2.cpy.re/api/v1' |
6441981b RK |
1295 | description: Live Test Server (live data - bleeding edge version) |
1296 | - url: 'https://peertube3.cpy.re/api/v1' | |
1297 | description: Live Test Server (live data - bleeding edge version) | |
3e9e6f2f RK |
1298 | components: |
1299 | parameters: | |
1300 | start: | |
1301 | name: start | |
1302 | in: query | |
1303 | required: false | |
1304 | description: Offset | |
1305 | schema: | |
1569a818 | 1306 | type: number |
3e9e6f2f RK |
1307 | count: |
1308 | name: count | |
1309 | in: query | |
1310 | required: false | |
1311 | description: Number of items | |
1312 | schema: | |
1569a818 | 1313 | type: number |
3e9e6f2f RK |
1314 | sort: |
1315 | name: sort | |
1316 | in: query | |
1317 | required: false | |
1318 | description: Sort column (-createdAt for example) | |
1319 | schema: | |
1320 | type: string | |
fd5af7a2 RK |
1321 | videosSort: |
1322 | name: sort | |
1323 | in: query | |
1324 | required: false | |
1325 | description: Sort videos by criteria | |
1326 | schema: | |
1327 | type: string | |
1328 | enum: | |
1329 | - -name | |
1330 | - -duration | |
1331 | - -createdAt | |
1332 | - -publishedAt | |
1333 | - -views | |
1334 | - -likes | |
1335 | - -trending | |
1336 | videosSearchSort: | |
1337 | name: sort | |
1338 | in: query | |
1339 | required: false | |
1340 | description: Sort videos by criteria | |
1341 | schema: | |
1342 | type: string | |
1343 | enum: | |
1344 | - -name | |
1345 | - -duration | |
1346 | - -createdAt | |
1347 | - -publishedAt | |
1348 | - -views | |
1349 | - -likes | |
1350 | - -match | |
1351 | blacklistsSort: | |
1352 | name: sort | |
1353 | in: query | |
1354 | required: false | |
1355 | description: Sort blacklists by criteria | |
1356 | schema: | |
1357 | type: string | |
1358 | enum: | |
1359 | - -id | |
1360 | - -name | |
1361 | - -duration | |
1362 | - -views | |
1363 | - -likes | |
1364 | - -dislikes | |
1365 | - -uuid | |
1366 | - -createdAt | |
1367 | usersSort: | |
1368 | name: sort | |
1369 | in: query | |
1370 | required: false | |
1371 | description: Sort users by criteria | |
1372 | schema: | |
1373 | type: string | |
1374 | enum: | |
1375 | - -id | |
1376 | - -username | |
1377 | - -createdAt | |
1378 | abusesSort: | |
1379 | name: sort | |
1380 | in: query | |
1381 | required: false | |
1382 | description: Sort abuses by criteria | |
1383 | schema: | |
1384 | type: string | |
1385 | enum: | |
1386 | - -id | |
1387 | - -createdAt | |
1388 | - -state | |
3e9e6f2f RK |
1389 | name: |
1390 | name: name | |
1391 | in: path | |
1392 | required: true | |
1393 | description: >- | |
1394 | The name of the account (chocobozzz or chocobozzz@peertube.cpy.re for | |
1395 | example) | |
1396 | schema: | |
1397 | type: string | |
1398 | id: | |
1399 | name: id | |
1400 | in: path | |
1401 | required: true | |
1402 | description: The user id | |
1403 | schema: | |
1569a818 | 1404 | type: number |
3e9e6f2f RK |
1405 | id2: |
1406 | name: id | |
1407 | in: path | |
1408 | required: true | |
1409 | description: The video id or uuid | |
1410 | schema: | |
1411 | type: string | |
1412 | id3: | |
1413 | name: id | |
1414 | in: path | |
1415 | required: true | |
1416 | description: The video channel id or uuid | |
1417 | schema: | |
1418 | type: string | |
1419 | commentId: | |
1420 | name: threadId | |
1421 | in: path | |
1422 | required: true | |
1423 | description: The comment id | |
1424 | schema: | |
c360c494 | 1425 | type: number |
fd5af7a2 RK |
1426 | categoryOneOf: |
1427 | name: categoryOneOf | |
1428 | in: query | |
1429 | required: false | |
1430 | description: category id of the video | |
1431 | schema: | |
1432 | oneOf: | |
1433 | - type: number | |
1434 | - type: array | |
1435 | items: | |
1436 | type: number | |
1437 | tagsOneOf: | |
1438 | name: tagsOneOf | |
1439 | in: query | |
1440 | required: false | |
1441 | description: tag(s) of the video | |
1442 | schema: | |
1443 | oneOf: | |
1444 | - type: string | |
1445 | - type: array | |
1446 | items: | |
1447 | type: string | |
1448 | tagsAllOf: | |
1449 | name: tagsAllOf | |
1450 | in: query | |
1451 | required: false | |
1452 | description: tag(s) of the video, where all should be present in the video | |
1453 | schema: | |
1454 | oneOf: | |
1455 | - type: string | |
1456 | - type: array | |
1457 | items: | |
1458 | type: string | |
1459 | languageOneOf: | |
1460 | name: languageOneOf | |
1461 | in: query | |
1462 | required: false | |
1463 | description: language id of the video | |
1464 | schema: | |
1465 | oneOf: | |
1466 | - type: number | |
1467 | - type: array | |
1468 | items: | |
1469 | type: number | |
1470 | licenceOneOf: | |
1471 | name: licenceOneOf | |
1472 | in: query | |
1473 | required: false | |
1474 | description: licence id of the video | |
1475 | schema: | |
1476 | oneOf: | |
1477 | - type: number | |
1478 | - type: array | |
1479 | items: | |
1480 | type: number | |
1481 | nsfw: | |
1482 | name: nsfw | |
1483 | in: query | |
1484 | required: false | |
1485 | description: whether to include nsfw videos, if any | |
1486 | schema: | |
1487 | type: string | |
1488 | enum: | |
1489 | - 'true' | |
1490 | - 'false' | |
1491 | filter: | |
1492 | name: filter | |
1493 | in: query | |
1494 | required: false | |
1495 | description: > | |
1496 | Special filters (local for instance) which might require special rights: | |
1497 | * `local` - only videos local to the instance | |
1498 | * `all-local` - only videos local to the instance, but showing private and unlisted videos (requires Admin privileges) | |
1499 | schema: | |
1500 | type: string | |
1501 | enum: | |
1502 | - local | |
1503 | - all-local | |
3e9e6f2f RK |
1504 | requestBodies: |
1505 | VideoChannelInput: | |
1506 | content: | |
1507 | application/json: | |
1508 | schema: | |
1509 | $ref: '#/components/schemas/VideoChannelInput' | |
1510 | securitySchemes: | |
1511 | OAuth2: | |
1512 | description: > | |
1513 | In the header: *Authorization: Bearer <token\>* | |
1514 | ||
1515 | ||
1516 | Authenticating via OAuth requires the following steps: | |
1517 | ||
1518 | ||
1519 | - Have an account with sufficient authorization levels | |
1520 | ||
1521 | - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a | |
1522 | Bearer Token | |
1523 | ||
1524 | - Make Authenticated Requests | |
1525 | type: oauth2 | |
1526 | flows: | |
1527 | password: | |
1528 | tokenUrl: 'https://peertube.example.com/api/v1/users/token' | |
1529 | scopes: | |
1530 | admin: Admin scope | |
1531 | moderator: Moderator scope | |
1532 | user: User scope | |
1533 | schemas: | |
1534 | VideoConstantNumber: | |
1535 | properties: | |
1536 | id: | |
1537 | type: number | |
1538 | label: | |
1539 | type: string | |
1540 | VideoConstantString: | |
1541 | properties: | |
1542 | id: | |
1543 | type: string | |
1544 | label: | |
1545 | type: string | |
1546 | VideoPrivacy: | |
1547 | type: string | |
1548 | enum: | |
1549 | - Public | |
1550 | - Unlisted | |
1551 | - Private | |
1552 | Video: | |
1553 | properties: | |
1554 | id: | |
1555 | type: number | |
1556 | uuid: | |
1557 | type: string | |
1558 | createdAt: | |
1559 | type: string | |
1560 | publishedAt: | |
1561 | type: string | |
1562 | updatedAt: | |
1563 | type: string | |
1564 | category: | |
1565 | $ref: '#/components/schemas/VideoConstantNumber' | |
1566 | licence: | |
1567 | $ref: '#/components/schemas/VideoConstantNumber' | |
1568 | language: | |
1569 | $ref: '#/components/schemas/VideoConstantString' | |
1570 | privacy: | |
1571 | $ref: '#/components/schemas/VideoPrivacy' | |
1572 | description: | |
1573 | type: string | |
1574 | duration: | |
1575 | type: number | |
1576 | isLocal: | |
1577 | type: boolean | |
1578 | name: | |
1579 | type: string | |
1580 | thumbnailPath: | |
1581 | type: string | |
1582 | previewPath: | |
1583 | type: string | |
1584 | embedPath: | |
1585 | type: string | |
1586 | views: | |
1587 | type: number | |
1588 | likes: | |
1589 | type: number | |
1590 | dislikes: | |
1591 | type: number | |
1592 | nsfw: | |
1593 | type: boolean | |
1594 | account: | |
1595 | type: object | |
1596 | properties: | |
1597 | name: | |
1598 | type: string | |
1599 | displayName: | |
1600 | type: string | |
1601 | url: | |
1602 | type: string | |
1603 | host: | |
1604 | type: string | |
1605 | avatar: | |
1606 | $ref: '#/components/schemas/Avatar' | |
1607 | VideoAbuse: | |
1608 | properties: | |
1609 | id: | |
1610 | type: number | |
1611 | reason: | |
1612 | type: string | |
1613 | reporterAccount: | |
1614 | $ref: '#/components/schemas/Account' | |
1615 | video: | |
1616 | type: object | |
1617 | properties: | |
1618 | id: | |
1619 | type: number | |
1620 | name: | |
1621 | type: string | |
1622 | uuid: | |
1623 | type: string | |
1624 | url: | |
1625 | type: string | |
1626 | createdAt: | |
1627 | type: string | |
1628 | VideoBlacklist: | |
1629 | properties: | |
1630 | id: | |
1631 | type: number | |
1632 | videoId: | |
1633 | type: number | |
1634 | createdAt: | |
1635 | type: string | |
1636 | updatedAt: | |
1637 | type: string | |
1638 | name: | |
1639 | type: string | |
1640 | uuid: | |
1641 | type: string | |
1642 | description: | |
1643 | type: string | |
1644 | duration: | |
1645 | type: number | |
1646 | views: | |
1647 | type: number | |
1648 | likes: | |
1649 | type: number | |
1650 | dislikes: | |
1651 | type: number | |
1652 | nsfw: | |
1653 | type: boolean | |
1654 | VideoChannel: | |
1655 | properties: | |
1656 | displayName: | |
1657 | type: string | |
1658 | description: | |
1659 | type: string | |
1660 | isLocal: | |
1661 | type: boolean | |
1662 | ownerAccount: | |
1663 | type: object | |
1664 | properties: | |
1665 | id: | |
1666 | type: number | |
1667 | uuid: | |
1668 | type: string | |
1669 | VideoComment: | |
1670 | properties: | |
1671 | id: | |
1672 | type: number | |
1673 | url: | |
1674 | type: string | |
1675 | text: | |
1676 | type: string | |
1677 | threadId: | |
1678 | type: number | |
1679 | inReplyToCommentId: | |
1680 | type: number | |
1681 | videoId: | |
1682 | type: number | |
1683 | createdAt: | |
1684 | type: string | |
1685 | updatedAt: | |
1686 | type: string | |
1687 | totalReplies: | |
1688 | type: number | |
1689 | account: | |
1690 | $ref: '#/components/schemas/Account' | |
1691 | VideoCommentThreadTree: | |
1692 | properties: | |
1693 | comment: | |
1694 | $ref: '#/components/schemas/VideoComment' | |
1695 | children: | |
1696 | type: array | |
1697 | items: | |
1698 | $ref: '#/components/schemas/VideoCommentThreadTree' | |
1699 | Avatar: | |
1700 | properties: | |
1701 | path: | |
1702 | type: string | |
1703 | createdAt: | |
1704 | type: string | |
1705 | updatedAt: | |
1706 | type: string | |
1707 | Actor: | |
1708 | properties: | |
1709 | id: | |
1710 | type: number | |
1711 | uuid: | |
1712 | type: string | |
1713 | url: | |
1714 | type: string | |
1715 | name: | |
1716 | type: string | |
1717 | host: | |
1718 | type: string | |
1719 | followingCount: | |
1720 | type: number | |
1721 | followersCount: | |
1722 | type: number | |
1723 | createdAt: | |
1724 | type: string | |
1725 | updatedAt: | |
1726 | type: string | |
1727 | avatar: | |
1728 | $ref: '#/components/schemas/Avatar' | |
1729 | Account: | |
1730 | allOf: | |
1731 | - $ref: '#/components/schemas/Actor' | |
1732 | - properties: | |
1733 | displayName: | |
1734 | type: string | |
1735 | User: | |
1736 | properties: | |
1737 | id: | |
1738 | type: number | |
1739 | username: | |
1740 | type: string | |
1741 | email: | |
1742 | type: string | |
1743 | displayNSFW: | |
1744 | type: boolean | |
1745 | autoPlayVideo: | |
1746 | type: boolean | |
1747 | role: | |
1748 | type: string | |
1749 | enum: | |
1750 | - User | |
1751 | - Moderator | |
1752 | - Administrator | |
1753 | videoQuota: | |
1754 | type: number | |
1755 | createdAt: | |
1756 | type: string | |
1757 | account: | |
1758 | $ref: '#/components/schemas/Account' | |
1759 | videoChannels: | |
1760 | type: array | |
1761 | items: | |
1762 | $ref: '#/components/schemas/VideoChannel' | |
6441981b RK |
1763 | UserWatchingVideo: |
1764 | properties: | |
1765 | currentTime: | |
1766 | type: number | |
3e9e6f2f RK |
1767 | ServerConfig: |
1768 | properties: | |
1769 | signup: | |
1770 | type: object | |
1771 | properties: | |
1772 | allowed: | |
1773 | type: boolean | |
1774 | transcoding: | |
1775 | type: object | |
1776 | properties: | |
1777 | enabledResolutions: | |
1778 | type: array | |
1779 | items: | |
1780 | type: number | |
1781 | avatar: | |
1782 | type: object | |
1783 | properties: | |
1784 | file: | |
1785 | type: object | |
1786 | properties: | |
1787 | size: | |
1788 | type: object | |
1789 | properties: | |
1790 | max: | |
1791 | type: number | |
1792 | extensions: | |
1793 | type: array | |
1794 | items: | |
1795 | type: string | |
1796 | video: | |
1797 | type: object | |
1798 | properties: | |
1799 | file: | |
1800 | type: object | |
1801 | properties: | |
1802 | extensions: | |
1803 | type: array | |
1804 | items: | |
1805 | type: string | |
1806 | Follow: | |
1807 | properties: | |
1808 | id: | |
1809 | type: number | |
1810 | follower: | |
1811 | $ref: '#/components/schemas/Actor' | |
1812 | following: | |
1813 | $ref: '#/components/schemas/Actor' | |
1814 | score: | |
1815 | type: number | |
1816 | state: | |
1817 | type: string | |
1818 | enum: | |
1819 | - pending | |
1820 | - accepted | |
1821 | createdAt: | |
1822 | type: string | |
1823 | updatedAt: | |
1824 | type: string | |
1825 | Job: | |
1826 | properties: | |
1827 | id: | |
1828 | type: number | |
1829 | state: | |
1830 | type: string | |
1831 | enum: | |
1832 | - pending | |
1833 | - processing | |
1834 | - error | |
1835 | - success | |
1836 | category: | |
1837 | type: string | |
1838 | enum: | |
1839 | - transcoding | |
1840 | - activitypub-http | |
1841 | handlerName: | |
1842 | type: string | |
1843 | handlerInputData: | |
1844 | type: string | |
1845 | createdAt: | |
1846 | type: string | |
1847 | updatedAt: | |
1848 | type: string | |
1849 | AddUserResponse: | |
1850 | properties: | |
1851 | id: | |
1852 | type: number | |
1853 | uuid: | |
1854 | type: string | |
1855 | VideoUploadResponse: | |
1856 | properties: | |
1857 | video: | |
1858 | type: object | |
1859 | properties: | |
1860 | id: | |
1861 | type: number | |
1862 | uuid: | |
1863 | type: string | |
1864 | CommentThreadResponse: | |
1865 | properties: | |
1866 | total: | |
1867 | type: number | |
1868 | data: | |
1869 | type: array | |
1870 | items: | |
1871 | $ref: '#/components/schemas/VideoComment' | |
1872 | CommentThreadPostResponse: | |
1873 | properties: | |
1874 | comment: | |
1875 | $ref: '#/components/schemas/VideoComment' | |
1876 | AddUser: | |
1877 | properties: | |
1878 | username: | |
1879 | type: string | |
1880 | description: 'The user username ' | |
1881 | password: | |
1882 | type: string | |
1883 | description: 'The user password ' | |
1884 | email: | |
1885 | type: string | |
1886 | description: 'The user email ' | |
1887 | videoQuota: | |
1888 | type: string | |
1889 | description: 'The user videoQuota ' | |
1890 | role: | |
0f490230 RK |
1891 | type: integer |
1892 | format: int32 | |
1893 | enum: | |
1894 | - 0 | |
1895 | - 1 | |
1896 | - 2 | |
3e9e6f2f RK |
1897 | description: 'The user role ' |
1898 | required: | |
1899 | - username | |
1900 | - password | |
1901 | ||
1902 | - videoQuota | |
1903 | - role | |
1904 | UpdateUser: | |
1905 | properties: | |
1906 | id: | |
1907 | type: string | |
1908 | description: 'The user id ' | |
1909 | email: | |
1910 | type: string | |
1911 | description: 'The updated email of the user ' | |
1912 | videoQuota: | |
1913 | type: string | |
1914 | description: 'The updated videoQuota of the user ' | |
1915 | role: | |
1916 | type: string | |
1917 | description: 'The updated role of the user ' | |
1918 | required: | |
1919 | - id | |
1920 | ||
1921 | - videoQuota | |
1922 | - role | |
1923 | UpdateMe: | |
1924 | properties: | |
1925 | password: | |
1926 | type: string | |
1927 | description: 'Your new password ' | |
1928 | email: | |
1929 | type: string | |
1930 | description: 'Your new email ' | |
1931 | displayNSFW: | |
1932 | type: string | |
1933 | description: 'Your new displayNSFW ' | |
1934 | autoPlayVideo: | |
1935 | type: string | |
1936 | description: 'Your new autoPlayVideo ' | |
1937 | required: | |
1938 | - password | |
1939 | ||
1940 | - displayNSFW | |
1941 | - autoPlayVideo | |
1942 | GetMeVideoRating: | |
1943 | properties: | |
1944 | id: | |
1945 | type: string | |
1946 | description: 'Id of the video ' | |
1947 | rating: | |
1948 | type: number | |
1949 | description: 'Rating of the video ' | |
1950 | required: | |
1951 | - id | |
1952 | - rating | |
1953 | RegisterUser: | |
1954 | properties: | |
1955 | username: | |
1956 | type: string | |
1957 | description: 'The username of the user ' | |
1958 | password: | |
1959 | type: string | |
1960 | description: 'The password of the user ' | |
1961 | email: | |
1962 | type: string | |
1963 | description: 'The email of the user ' | |
1964 | required: | |
1965 | - username | |
1966 | - password | |
1967 | ||
1968 | VideoChannelInput: | |
1969 | properties: | |
1970 | name: | |
1971 | type: string | |
1972 | description: | |
1973 | type: string | |
1569a818 | 1974 |