fix API spec on POST /videos/upload and provide Shell example
This commit is contained in:
parent
6385c0cb7f
commit
8f9e8be1fc
1 changed files with 39 additions and 3 deletions
|
@ -116,12 +116,16 @@ paths:
|
||||||
x-code-samples:
|
x-code-samples:
|
||||||
- lang: JavaScript
|
- lang: JavaScript
|
||||||
source: |
|
source: |
|
||||||
fetch('https://peertube.cpy.re/api/v1/accounts/{name}/videos')
|
fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
return response.json()
|
return response.json()
|
||||||
}).then(function(data) {
|
}).then(function(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
})
|
})
|
||||||
|
- lang: Shell
|
||||||
|
source: |
|
||||||
|
# pip install httpie
|
||||||
|
http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
|
||||||
/accounts:
|
/accounts:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -131,7 +135,7 @@ paths:
|
||||||
'200':
|
'200':
|
||||||
description: successful operation
|
description: successful operation
|
||||||
content:
|
content:
|
||||||
'application/jsonhttps://peertube.cpy.re/api/v1':
|
'application/json':
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
@ -730,6 +734,8 @@ paths:
|
||||||
previewfile:
|
previewfile:
|
||||||
description: Video preview file
|
description: Video preview file
|
||||||
type: string
|
type: string
|
||||||
|
privacy:
|
||||||
|
$ref: '#/components/schemas/VideoPrivacy'
|
||||||
category:
|
category:
|
||||||
description: Video category
|
description: Video category
|
||||||
type: string
|
type: string
|
||||||
|
@ -764,6 +770,36 @@ paths:
|
||||||
required:
|
required:
|
||||||
- videofile
|
- videofile
|
||||||
- channelId
|
- channelId
|
||||||
|
- name
|
||||||
|
- privacy
|
||||||
|
x-code-samples:
|
||||||
|
- lang: Shell
|
||||||
|
source: |
|
||||||
|
## DEPENDENCIES: httpie, jq
|
||||||
|
# pip install httpie
|
||||||
|
USERNAME="<your_username>"
|
||||||
|
PASSWORD="<your_password>"
|
||||||
|
FILE_PATH="<your_file_path>"
|
||||||
|
CHANNEL_ID="<your_channel_id>"
|
||||||
|
PRIVACY="1" # public: 1, unlisted: 2, private: 3
|
||||||
|
NAME="<video_name>"
|
||||||
|
|
||||||
|
API_PATH="https://peertube2.cpy.re/api/v1"
|
||||||
|
## AUTH
|
||||||
|
client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
|
||||||
|
client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
|
||||||
|
token=$(http -b --form POST "$API_PATH/users/token" \
|
||||||
|
client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
|
||||||
|
username=$USERNAME \
|
||||||
|
password=$PASSWORD \
|
||||||
|
| jq -r ".access_token")
|
||||||
|
## VIDEO UPLOAD
|
||||||
|
http -b --form POST "$API_PATH/videos/upload" \
|
||||||
|
videofile@$FILE_PATH \
|
||||||
|
channelId=$CHANNEL_ID \
|
||||||
|
name=$NAME \
|
||||||
|
privacy=$PRIVACY \
|
||||||
|
"Authorization:Bearer $token"
|
||||||
/videos/abuse:
|
/videos/abuse:
|
||||||
get:
|
get:
|
||||||
summary: Get list of reported video abuses
|
summary: Get list of reported video abuses
|
||||||
|
@ -1060,7 +1096,7 @@ paths:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Video'
|
$ref: '#/components/schemas/Video'
|
||||||
servers:
|
servers:
|
||||||
- url: 'https://peertube.cpy.re/api/v1'
|
- url: 'https://peertube2.cpy.re/api/v1'
|
||||||
description: Live Server
|
description: Live Server
|
||||||
components:
|
components:
|
||||||
parameters:
|
parameters:
|
||||||
|
|
Loading…
Reference in a new issue