diff options
Diffstat (limited to 'support/doc/api')
-rw-r--r-- | support/doc/api/openapi.yaml | 146 | ||||
-rw-r--r-- | support/doc/api/quickstart.md | 2 |
2 files changed, 118 insertions, 30 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 9963e1d26..a8a064fd0 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -38,7 +38,7 @@ info: | |||
38 | } | 38 | } |
39 | ``` | 39 | ``` |
40 | externalDocs: | 40 | externalDocs: |
41 | url: https://docs.joinpeertube.org/api.html | 41 | url: https://docs.joinpeertube.org/#/api-rest-reference.html |
42 | tags: | 42 | tags: |
43 | - name: Accounts | 43 | - name: Accounts |
44 | description: > | 44 | description: > |
@@ -99,6 +99,7 @@ x-tagGroups: | |||
99 | - name: Videos | 99 | - name: Videos |
100 | tags: | 100 | tags: |
101 | - Video | 101 | - Video |
102 | - Video Caption | ||
102 | - Video Channel | 103 | - Video Channel |
103 | - Video Comment | 104 | - Video Comment |
104 | - Video Following | 105 | - Video Following |
@@ -152,7 +153,7 @@ paths: | |||
152 | content: | 153 | content: |
153 | application/json: | 154 | application/json: |
154 | schema: | 155 | schema: |
155 | $ref: '#/components/schemas/Video' | 156 | $ref: '#/components/schemas/VideoListResponse' |
156 | x-code-samples: | 157 | x-code-samples: |
157 | - lang: JavaScript | 158 | - lang: JavaScript |
158 | source: | | 159 | source: | |
@@ -575,9 +576,7 @@ paths: | |||
575 | content: | 576 | content: |
576 | application/json: | 577 | application/json: |
577 | schema: | 578 | schema: |
578 | type: array | 579 | $ref: '#/components/schemas/VideoListResponse' |
579 | items: | ||
580 | $ref: '#/components/schemas/Video' | ||
581 | /users/me/subscriptions: | 580 | /users/me/subscriptions: |
582 | get: | 581 | get: |
583 | summary: Get subscriptions of the current user | 582 | summary: Get subscriptions of the current user |
@@ -638,9 +637,7 @@ paths: | |||
638 | content: | 637 | content: |
639 | application/json: | 638 | application/json: |
640 | schema: | 639 | schema: |
641 | type: array | 640 | $ref: '#/components/schemas/VideoListResponse' |
642 | items: | ||
643 | $ref: '#/components/schemas/Video' | ||
644 | '/users/me/subscriptions/{uri}': | 641 | '/users/me/subscriptions/{uri}': |
645 | get: | 642 | get: |
646 | summary: Get subscription of the current user for a given uri | 643 | summary: Get subscription of the current user for a given uri |
@@ -730,9 +727,7 @@ paths: | |||
730 | content: | 727 | content: |
731 | application/json: | 728 | application/json: |
732 | schema: | 729 | schema: |
733 | type: array | 730 | $ref: '#/components/schemas/VideoListResponse' |
734 | items: | ||
735 | $ref: '#/components/schemas/Video' | ||
736 | /videos/categories: | 731 | /videos/categories: |
737 | get: | 732 | get: |
738 | summary: Get list of video licences known by the server | 733 | summary: Get list of video licences known by the server |
@@ -1025,7 +1020,7 @@ paths: | |||
1025 | description: Video preview file | 1020 | description: Video preview file |
1026 | type: string | 1021 | type: string |
1027 | privacy: | 1022 | privacy: |
1028 | $ref: '#/components/schemas/VideoPrivacy' | 1023 | $ref: '#/components/schemas/VideoPrivacySet' |
1029 | category: | 1024 | category: |
1030 | description: Video category | 1025 | description: Video category |
1031 | type: string | 1026 | type: string |
@@ -1129,7 +1124,7 @@ paths: | |||
1129 | description: Video preview file | 1124 | description: Video preview file |
1130 | type: string | 1125 | type: string |
1131 | privacy: | 1126 | privacy: |
1132 | $ref: '#/components/schemas/VideoPrivacy' | 1127 | $ref: '#/components/schemas/VideoPrivacySet' |
1133 | category: | 1128 | category: |
1134 | description: Video category | 1129 | description: Video category |
1135 | type: string | 1130 | type: string |
@@ -1247,6 +1242,58 @@ paths: | |||
1247 | type: array | 1242 | type: array |
1248 | items: | 1243 | items: |
1249 | $ref: '#/components/schemas/VideoBlacklist' | 1244 | $ref: '#/components/schemas/VideoBlacklist' |
1245 | /videos/{id}/captions: | ||
1246 | get: | ||
1247 | summary: Get list of video's captions | ||
1248 | tags: | ||
1249 | - Video Caption | ||
1250 | parameters: | ||
1251 | - $ref: '#/components/parameters/id2' | ||
1252 | responses: | ||
1253 | '200': | ||
1254 | description: successful operation | ||
1255 | content: | ||
1256 | application/json: | ||
1257 | schema: | ||
1258 | type: object | ||
1259 | properties: | ||
1260 | total: | ||
1261 | type: integer | ||
1262 | data: | ||
1263 | type: array | ||
1264 | items: | ||
1265 | $ref: '#/components/schemas/VideoCaption' | ||
1266 | /videos/{id}/captions/{captionLanguage}: | ||
1267 | put: | ||
1268 | summary: Add or replace a video caption | ||
1269 | tags: | ||
1270 | - Video Caption | ||
1271 | parameters: | ||
1272 | - $ref: '#/components/parameters/id2' | ||
1273 | - $ref: '#/components/parameters/captionLanguage' | ||
1274 | requestBody: | ||
1275 | content: | ||
1276 | multipart/form-data: | ||
1277 | schema: | ||
1278 | type: object | ||
1279 | properties: | ||
1280 | captionfile: | ||
1281 | description: The file to upload. | ||
1282 | type: string | ||
1283 | format: binary | ||
1284 | responses: | ||
1285 | '204': | ||
1286 | $ref: '#/paths/~1users~1me/put/responses/204' | ||
1287 | delete: | ||
1288 | summary: Delete a video caption | ||
1289 | tags: | ||
1290 | - Video Caption | ||
1291 | parameters: | ||
1292 | - $ref: '#/components/parameters/id2' | ||
1293 | - $ref: '#/components/parameters/captionLanguage' | ||
1294 | responses: | ||
1295 | '204': | ||
1296 | $ref: '#/paths/~1users~1me/put/responses/204' | ||
1250 | /video-channels: | 1297 | /video-channels: |
1251 | get: | 1298 | get: |
1252 | summary: Get list of video channels | 1299 | summary: Get list of video channels |
@@ -1318,6 +1365,7 @@ paths: | |||
1318 | get: | 1365 | get: |
1319 | summary: Get videos of a video channel by its id | 1366 | summary: Get videos of a video channel by its id |
1320 | tags: | 1367 | tags: |
1368 | - Video | ||
1321 | - Video Channel | 1369 | - Video Channel |
1322 | parameters: | 1370 | parameters: |
1323 | - $ref: '#/components/parameters/channelHandle' | 1371 | - $ref: '#/components/parameters/channelHandle' |
@@ -1327,7 +1375,7 @@ paths: | |||
1327 | content: | 1375 | content: |
1328 | application/json: | 1376 | application/json: |
1329 | schema: | 1377 | schema: |
1330 | $ref: '#/components/schemas/Video' | 1378 | $ref: '#/components/schemas/VideoListResponse' |
1331 | '/accounts/{name}/video-channels': | 1379 | '/accounts/{name}/video-channels': |
1332 | get: | 1380 | get: |
1333 | summary: Get video channels of an account by its name | 1381 | summary: Get video channels of an account by its name |
@@ -1443,7 +1491,7 @@ paths: | |||
1443 | schema: | 1491 | schema: |
1444 | $ref: '#/components/schemas/CommentThreadPostResponse' | 1492 | $ref: '#/components/schemas/CommentThreadPostResponse' |
1445 | delete: | 1493 | delete: |
1446 | summary: 'Delete a comment in a comment therad by its id, of a video by its id' | 1494 | summary: 'Delete a comment in a comment thread by its id, of a video by its id' |
1447 | security: | 1495 | security: |
1448 | - OAuth2: [] | 1496 | - OAuth2: [] |
1449 | tags: | 1497 | tags: |
@@ -1487,9 +1535,7 @@ paths: | |||
1487 | content: | 1535 | content: |
1488 | application/json: | 1536 | application/json: |
1489 | schema: | 1537 | schema: |
1490 | type: array | 1538 | $ref: '#/components/schemas/VideoListResponse' |
1491 | items: | ||
1492 | $ref: '#/components/schemas/Video' | ||
1493 | servers: | 1539 | servers: |
1494 | - url: 'https://peertube.cpy.re/api/v1' | 1540 | - url: 'https://peertube.cpy.re/api/v1' |
1495 | description: Live Test Server (live data - stable version) | 1541 | description: Live Test Server (live data - stable version) |
@@ -1611,6 +1657,13 @@ components: | |||
1611 | description: The video id or uuid | 1657 | description: The video id or uuid |
1612 | schema: | 1658 | schema: |
1613 | type: string | 1659 | type: string |
1660 | captionLanguage: | ||
1661 | name: captionLanguage | ||
1662 | in: path | ||
1663 | required: true | ||
1664 | description: The caption language | ||
1665 | schema: | ||
1666 | type: string | ||
1614 | channelHandle: | 1667 | channelHandle: |
1615 | name: channelHandle | 1668 | name: channelHandle |
1616 | in: path | 1669 | in: path |
@@ -1739,7 +1792,7 @@ components: | |||
1739 | 1792 | ||
1740 | - Have an account with sufficient authorization levels | 1793 | - Have an account with sufficient authorization levels |
1741 | 1794 | ||
1742 | - [Generate](https://docs.joinpeertube.org/lang/en/devdocs/rest.html) a | 1795 | - [Generate](https://docs.joinpeertube.org/#/api-rest-getting-started) a |
1743 | Bearer Token | 1796 | Bearer Token |
1744 | 1797 | ||
1745 | - Make Authenticated Requests | 1798 | - Make Authenticated Requests |
@@ -1764,12 +1817,23 @@ components: | |||
1764 | type: string | 1817 | type: string |
1765 | label: | 1818 | label: |
1766 | type: string | 1819 | type: string |
1767 | VideoPrivacy: | 1820 | VideoPrivacySet: |
1768 | type: string | 1821 | type: integer |
1769 | enum: | 1822 | enum: |
1770 | - Public | 1823 | - 1 |
1771 | - Unlisted | 1824 | - 2 |
1772 | - Private | 1825 | - 3 |
1826 | description: 'The video privacy (Public = 1, Unlisted = 2, Private = 3)' | ||
1827 | VideoPrivacyConstant: | ||
1828 | properties: | ||
1829 | id: | ||
1830 | type: integer | ||
1831 | enum: | ||
1832 | - 1 | ||
1833 | - 2 | ||
1834 | - 3 | ||
1835 | label: | ||
1836 | type: string | ||
1773 | Video: | 1837 | Video: |
1774 | properties: | 1838 | properties: |
1775 | id: | 1839 | id: |
@@ -1789,7 +1853,7 @@ components: | |||
1789 | language: | 1853 | language: |
1790 | $ref: '#/components/schemas/VideoConstantString' | 1854 | $ref: '#/components/schemas/VideoConstantString' |
1791 | privacy: | 1855 | privacy: |
1792 | $ref: '#/components/schemas/VideoPrivacy' | 1856 | $ref: '#/components/schemas/VideoPrivacyConstant' |
1793 | description: | 1857 | description: |
1794 | type: string | 1858 | type: string |
1795 | duration: | 1859 | duration: |
@@ -1917,6 +1981,12 @@ components: | |||
1917 | type: array | 1981 | type: array |
1918 | items: | 1982 | items: |
1919 | $ref: '#/components/schemas/VideoCommentThreadTree' | 1983 | $ref: '#/components/schemas/VideoCommentThreadTree' |
1984 | VideoCaption: | ||
1985 | properties: | ||
1986 | language: | ||
1987 | $ref: '#/components/schemas/VideoConstantString' | ||
1988 | captionPath: | ||
1989 | type: string | ||
1920 | Avatar: | 1990 | Avatar: |
1921 | properties: | 1991 | properties: |
1922 | path: | 1992 | path: |
@@ -1966,6 +2036,13 @@ components: | |||
1966 | autoPlayVideo: | 2036 | autoPlayVideo: |
1967 | type: boolean | 2037 | type: boolean |
1968 | role: | 2038 | role: |
2039 | type: integer | ||
2040 | enum: | ||
2041 | - 0 | ||
2042 | - 1 | ||
2043 | - 2 | ||
2044 | description: 'The user role (Admin = 0, Moderator = 1, User = 2)' | ||
2045 | roleLabel: | ||
1969 | type: string | 2046 | type: string |
1970 | enum: | 2047 | enum: |
1971 | - User | 2048 | - User |
@@ -2096,6 +2173,14 @@ components: | |||
2096 | properties: | 2173 | properties: |
2097 | comment: | 2174 | comment: |
2098 | $ref: '#/components/schemas/VideoComment' | 2175 | $ref: '#/components/schemas/VideoComment' |
2176 | VideoListResponse: | ||
2177 | properties: | ||
2178 | total: | ||
2179 | type: number | ||
2180 | data: | ||
2181 | type: array | ||
2182 | items: | ||
2183 | $ref: '#/components/schemas/Video' | ||
2099 | AddUser: | 2184 | AddUser: |
2100 | properties: | 2185 | properties: |
2101 | username: | 2186 | username: |
@@ -2115,12 +2200,11 @@ components: | |||
2115 | description: 'The user daily video quota ' | 2200 | description: 'The user daily video quota ' |
2116 | role: | 2201 | role: |
2117 | type: integer | 2202 | type: integer |
2118 | format: int32 | ||
2119 | enum: | 2203 | enum: |
2120 | - 0 | 2204 | - 0 |
2121 | - 1 | 2205 | - 1 |
2122 | - 2 | 2206 | - 2 |
2123 | description: 'The user role ' | 2207 | description: 'The user role (Admin = 0, Moderator = 1, User = 2)' |
2124 | required: | 2208 | required: |
2125 | - username | 2209 | - username |
2126 | - password | 2210 | - password |
@@ -2143,8 +2227,12 @@ components: | |||
2143 | type: string | 2227 | type: string |
2144 | description: 'The updated daily video quota of the user ' | 2228 | description: 'The updated daily video quota of the user ' |
2145 | role: | 2229 | role: |
2146 | type: string | 2230 | type: integer |
2147 | description: 'The updated role of the user ' | 2231 | enum: |
2232 | - 0 | ||
2233 | - 1 | ||
2234 | - 2 | ||
2235 | description: 'The user role (Admin = 0, Moderator = 1, User = 2)' | ||
2148 | required: | 2236 | required: |
2149 | - id | 2237 | - id |
2150 | 2238 | ||
diff --git a/support/doc/api/quickstart.md b/support/doc/api/quickstart.md index 00874a1c9..2222be741 100644 --- a/support/doc/api/quickstart.md +++ b/support/doc/api/quickstart.md | |||
@@ -47,7 +47,7 @@ $ curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https | |||
47 | ``` | 47 | ``` |
48 | 48 | ||
49 | 49 | ||
50 | ### List videos | 50 | ## List videos |
51 | 51 | ||
52 | ```bash | 52 | ```bash |
53 | $ curl https://peertube.example.com/api/v1/videos | 53 | $ curl https://peertube.example.com/api/v1/videos |