PeerTube/support/doc/api/openapi.yaml

1635 lines
36 KiB
YAML

swagger: '2.0'
info:
title: PeerTube
version: 1.0.0-beta
description: Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.
host: peertube.example.com
securityDefinitions:
OAuth2:
description: 'In the header: *Authorization: Bearer mytoken*'
type: oauth2
flow: password
# Not implemented yet
# authorizationUrl: https://example.com/oauth/authorize
tokenUrl: https://peertube.example.com/api/v1/users/token
basePath: '/api/v1'
schemes:
- https
paths:
'/accounts/{id}':
get:
tags:
- Accounts
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The id of the account'
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Account'
/accounts:
get:
tags:
- Accounts
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Account'
/config:
get:
tags:
- Config
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/ServerConfig'
/jobs:
get:
security:
- OAuth2: [ ]
tags:
- Job
consumes:
- application/json
produces:
- application/json
parameters:
- name: state
in: path
required: true
type: string
description: 'The id of the account'
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: count
in: query
required: false
type: number
description: ''
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Job'
'/server/following/{host}':
delete:
security:
- OAuth2: [ ]
tags:
- ServerFollowing
consumes:
- application/json
produces:
- application/json
parameters:
- name: host
in: path
required: true
type: string
description: 'The host to unfollow '
responses:
'201':
description: successful operation
/server/followers:
get:
tags:
- ServerFollowing
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Follow'
/server/following:
get:
tags:
- ServerFollowing
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Follow'
post:
security:
- OAuth2: [ ]
tags:
- ServerFollowing
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/Follow'
responses:
'204':
description: successful operation
/users:
post:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
required: true
description: 'User to create'
schema:
$ref: '#/definitions/AddUser'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/AddUserResponse'
get:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/User'
'/users/{id}':
delete:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The user id '
responses:
'204':
description: successful operation
get:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The user id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/User'
put:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The user id '
- in: body
name: body
required: true
schema:
$ref: '#/definitions/UpdateUser'
responses:
'204':
description: successful operation
/users/me:
get:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/User'
put:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
required: true
schema:
$ref: '#/definitions/UpdateMe'
responses:
'204':
description: successful operation
/users/me/video-quota-used:
get:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters: []
responses:
'200':
description: successful operation
schema:
type: number
'/users/me/videos/{videoId}/rating':
get:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/GetMeVideoRating'
/users/me/videos:
get:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Video'
/users/register:
post:
tags:
- User
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
required: true
schema:
$ref: '#/definitions/RegisterUser'
responses:
'204':
description: successful operation
/users/me/avatar/pick:
post:
security:
- OAuth2: [ ]
tags:
- User
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- in: formData
name: avatarfile
type: file
description: The file to upload.
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Avatar'
/videos:
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Video'
/videos/categories:
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
type: array
items:
type: string
/videos/licences:
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
type: array
items:
type: string
/videos/languages:
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
type: array
items:
type: string
/videos/privacies:
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
schema:
type: array
items:
type: string
/videos/search:
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Video'
"/videos/{id}":
put:
security:
- OAuth2: [ ]
tags:
- Video
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id'
- name: thumbnailfile
in: formData
type: file
description: 'Video thumbnail file'
- name: previewfile
in: formData
type: file
description: 'Video preview file'
- name: category
in: formData
type: number
description: 'Video category'
- name: licence
in: formData
type: number
description: 'Video licence'
- name: language
in: formData
type: number
description: 'Video language'
- name: description
in: formData
type: string
description: 'Video description'
- name: support
in: formData
type: string
description: 'Text describing how to support the video uploader'
- name: nsfw
in: formData
type: boolean
description: 'Whether or not this video contains sensitive content'
- name: name
in: formData
type: string
description: 'Video name'
- name: tags
in: formData
type: string[]
description: 'Video tags'
- name: commentsEnabled
in: formData
type: boolean
description: 'Enable or disable comments for this video'
- name: privacy
in: formData
type: string
enum: [Public, Unlisted]
description: 'Video privacy'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Video'
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Video'
delete:
security:
- OAuth2: [ ]
tags:
- Video
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
"/videos/{id}/description":
get:
tags:
- Video
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'200':
description: successful operation
schema:
type: string
"/videos/{id}/views":
post:
tags:
- Video
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
/videos/upload:
post:
security:
- OAuth2: [ ]
tags:
- Video
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: videofile
in: formData
type: file
required: true
description: 'Video file'
- name: thumbnailfile
in: formData
type: file
required: true
description: 'Video thumbnail file'
- name: previewfile
in: formData
type: file
required: true
description: 'Video preview file'
- name: category
in: formData
type: number
description: 'Video category'
- name: licence
in: formData
type: number
description: 'Video licence'
- name: language
in: formData
type: number
description: 'Video language'
- name: description
in: formData
type: string
description: 'Video description'
- name: support
in: formData
type: string
description: 'Text describing how to support the video uploader'
- name: channelId
in: formData
required: true
type: number
description: 'Channel id that will contain this video'
- name: nsfw
in: formData
required: true
type: boolean
description: 'Whether or not this video contains sensitive content'
- name: name
in: formData
required: true
type: string
description: 'Video name'
- name: tags
in: formData
type: string[]
description: 'Video tags'
- name: commentsEnabled
in: formData
type: boolean
description: 'Enable or disable comments for this video'
- name: privacy
in: formData
required: true
type: string
enum: [Public, Unlisted, Private]
description: 'Video privacy'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/VideoUploadResponse'
/videos/abuse:
get:
security:
- OAuth2: [ ]
tags:
- VideoAbuse
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/VideoAbuse'
"/videos/{id}/abuse":
post:
security:
- OAuth2: [ ]
tags:
- VideoAbuse
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
"/videos/{videoId}/blacklist":
post:
security:
- OAuth2: [ ]
tags:
- VideoBlacklist
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
delete:
security:
- OAuth2: [ ]
tags:
- VideoBlacklist
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
/videos/blacklist:
get:
security:
- OAuth2: [ ]
tags:
- VideoBlacklist
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/VideoBlacklist'
/videos/channels:
get:
tags:
- VideoChannel
consumes:
- application/json
produces:
- application/json
parameters:
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/VideoChannel'
post:
security:
- OAuth2: [ ]
tags:
- VideoChannel
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/VideoChannelInput'
responses:
'204':
description: successful operation
"/videos/channels/{id}":
get:
tags:
- VideoChannel
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/VideoChannel'
put:
security:
- OAuth2: [ ]
tags:
- VideoChannel
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
- in: body
name: body
schema:
$ref: '#/definitions/VideoChannelInput'
responses:
'204':
description: successful operation
delete:
security:
- OAuth2: [ ]
tags:
- VideoChannel
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
/videos/accounts/{accountId}/channels:
get:
tags:
- VideoChannel
consumes:
- application/json
produces:
- application/json
parameters:
- name: accountId
in: path
required: true
type: string
description: 'The account id '
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/VideoChannel'
"/videos/{videoId}/comment-threads":
get:
tags:
- VideoComment
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
- name: start
in: query
required: false
type: number
description: 'starting page'
- name: stop
in: query
required: false
type: number
description: 'stopping page'
- name: sort
in: query
required: false
type: number
description: 'sorting'
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/CommentThreadResponse'
post:
security:
- OAuth2: [ ]
tags:
- VideoComment
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/CommentThreadPostResponse'
"/videos/{videoId}/comment-threads/{threadId}":
get:
tags:
- VideoComment
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
- name: threadId
in: path
required: true
type: string
description: 'The thread id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/VideoCommentThreadTree'
"/videos/{videoId}/comments/{commentId}":
post:
security:
- OAuth2: [ ]
tags:
- VideoComment
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
- name: commentId
in: path
required: true
type: string
description: 'The comment id '
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/CommentThreadPostResponse'
delete:
security:
- OAuth2: [ ]
tags:
- VideoComment
consumes:
- application/json
produces:
- application/json
parameters:
- name: videoId
in: path
required: true
type: string
description: 'The video id '
- name: commentId
in: path
required: true
type: string
description: 'The comment id '
responses:
'204':
description: successful operation
"/videos/{id}/rate":
put:
security:
- OAuth2: [ ]
tags:
- VideoRate
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
required: true
type: string
description: 'The video id '
responses:
'204':
description: successful operation
definitions:
VideoConstant:
properties:
id:
type: number
label:
type: string
VideoPrivacy:
type: string
enum: [Public, Unlisted, Private]
Video:
properties:
id:
type: number
uuid:
type: string
createdAt:
type: string
publishedAt:
type: string
updatedAt:
type: string
category:
$ref: "#/definitions/VideoConstant"
licence:
$ref: "#/definitions/VideoConstant"
language:
$ref: "#/definitions/VideoConstant"
privacy:
$ref: "#/definitions/VideoPrivacy"
description:
type: string
duration:
type: number
isLocal:
type: boolean
name:
type: string
thumbnailPath:
type: string
previewPath:
type: string
embedPath:
type: string
views:
type: number
likes:
type: number
dislikes:
type: number
nsfw:
type: boolean
account:
type: object
properties:
name:
type: string
displayName:
type: string
url:
type: string
host:
type: string
avatar:
$ref: "#/definitions/Avatar"
VideoAbuse:
properties:
id:
type: number
reason:
type: string
reporterAccount:
$ref: "#/definitions/Account"
video:
type: object
properties:
id:
type: number
name:
type: string
uuid:
type: string
url:
type: string
createdAt:
type: string
VideoBlacklist:
properties:
id:
type: number
videoId:
type: number
createdAt:
type: string
updatedAt:
type: string
name:
type: string
uuid:
type: string
description:
type: string
duration:
type: number
views:
type: number
likes:
type: number
dislikes:
type: number
nsfw:
type: boolean
VideoChannel:
properties:
displayName:
type: string
description:
type: string
isLocal:
type: boolean
owner:
type: object
properties:
name:
type: string
uuid:
type: string
videos:
type: array
items:
$ref: "#/definitions/Video"
VideoComment:
properties:
id:
type: number
url:
type: string
text:
type: string
threadId:
type: number
inReplyToCommentId:
type: number
videoId:
type: number
createdAt:
type: string
updatedAt:
type: string
totalReplies:
type: number
account:
$ref: "#/definitions/Account"
VideoCommentThreadTree:
properties:
comment:
$ref: "#/definitions/VideoComment"
children:
type: array
items:
$ref: "#/definitions/VideoCommentThreadTree"
Avatar:
properties:
path:
type: string
createdAt:
type: string
updatedAt:
type: string
Actor:
properties:
id:
type: number
uuid:
type: string
url:
type: string
name:
type: string
host:
type: string
followingCount:
type: number
followersCount:
type: number
createdAt:
type: string
updatedAt:
type: string
avatar:
$ref: "#/definitions/Avatar"
Account:
allOf:
- $ref: "#/definitions/Actor"
- properties:
displayName:
type: string
User:
properties:
id:
type: number
username:
type: string
email:
type: string
displayNSFW:
type: boolean
autoPlayVideo:
type: boolean
role:
type: string
enum: [User, Moderator, Administrator]
videoQuota:
type: number
createdAt:
type: string
account:
$ref: "#/definitions/Account"
videoChannels:
type: array
items:
$ref: "#/definitions/VideoChannel"
ServerConfig:
properties:
signup:
type: object
properties:
allowed:
type: boolean
transcoding:
type: object
properties:
enabledResolutions:
type: array
items:
type: number
avatar:
type: object
properties:
file:
type: object
properties:
size:
type: object
properties:
max:
type: number
extensions:
type: array
items:
type: string
video:
type: object
properties:
file:
type: object
properties:
extensions:
type: array
items:
type: string
Follow:
properties:
id:
type: number
follower:
$ref: "#/definitions/Actor"
following:
$ref: "#/definitions/Actor"
score:
type: number
state:
type: string
enum: [pending, accepted]
createdAt:
type: string
updatedAt:
type: string
Job:
properties:
id:
type: number
state:
type: string
enum: [pending, processing, error, success]
category:
type: string
enum: [transcoding, activitypub-http]
handlerName:
type: string
handlerInputData:
type: string
createdAt:
type: string
updatedAt:
type: string
# Api responses
AddUserResponse:
properties:
id:
type: number
uuid:
type: string
VideoUploadResponse:
properties:
video:
type: object
properties:
id:
type: number
uuid:
type: string
CommentThreadResponse:
properties:
total:
type: number
data:
type: array
items:
$ref: "#/definitions/VideoComment"
CommentThreadPostResponse:
properties:
comment:
$ref: "#/definitions/VideoComment"
# Request bodies
AddUser:
properties:
username:
type: string
description: 'The user username '
password:
type: string
description: 'The user password '
email:
type: string
description: 'The user email '
videoQuota:
type: string
description: 'The user videoQuota '
role:
type: string
description: 'The user role '
required:
- username
- password
- email
- videoQuota
- role
UpdateUser:
properties:
id:
type: string
description: 'The user id '
email:
type: string
description: 'The updated email of the user '
videoQuota:
type: string
description: 'The updated videoQuota of the user '
role:
type: string
description: 'The updated role of the user '
required:
- id
- email
- videoQuota
- role
UpdateMe:
properties:
password:
type: string
description: 'Your new password '
email:
type: string
description: 'Your new email '
displayNSFW:
type: string
description: 'Your new displayNSFW '
autoPlayVideo:
type: string
description: 'Your new autoPlayVideo '
required:
- password
- email
- displayNSFW
- autoPlayVideo
GetMeVideoRating:
properties:
id:
type: string
description: 'Id of the video '
rating:
type: number
description: 'Rating of the video '
required:
- id
- rating
RegisterUser:
properties:
username:
type: string
description: 'The username of the user '
password:
type: string
description: 'The password of the user '
email:
type: string
description: 'The email of the user '
required:
- username
- password
- email
VideoChannelInput:
properties:
name:
type: string
description:
type: string