Switch examples to curl since httpie has a 512MB limit (#3012)
Co-authored-by: Rigel Kent <par@rigelk.eu>
This commit is contained in:
parent
a949f67636
commit
0579dee3b2
|
@ -233,8 +233,8 @@ paths:
|
||||||
})
|
})
|
||||||
- lang: Shell
|
- lang: Shell
|
||||||
source: |
|
source: |
|
||||||
# pip install httpie
|
## DEPENDENCIES: jq
|
||||||
http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
|
curl -s https://peertube2.cpy.re/api/v1/accounts/{name}/videos | jq
|
||||||
- lang: Ruby
|
- lang: Ruby
|
||||||
source: |
|
source: |
|
||||||
require 'net/http'
|
require 'net/http'
|
||||||
|
@ -1351,8 +1351,7 @@ paths:
|
||||||
x-code-samples:
|
x-code-samples:
|
||||||
- lang: Shell
|
- lang: Shell
|
||||||
source: |
|
source: |
|
||||||
## DEPENDENCIES: httpie, jq
|
## DEPENDENCIES: jq
|
||||||
# pip install httpie
|
|
||||||
USERNAME="<your_username>"
|
USERNAME="<your_username>"
|
||||||
PASSWORD="<your_password>"
|
PASSWORD="<your_password>"
|
||||||
FILE_PATH="<your_file_path>"
|
FILE_PATH="<your_file_path>"
|
||||||
|
@ -1361,19 +1360,23 @@ paths:
|
||||||
|
|
||||||
API_PATH="https://peertube2.cpy.re/api/v1"
|
API_PATH="https://peertube2.cpy.re/api/v1"
|
||||||
## AUTH
|
## AUTH
|
||||||
client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
|
client_id=$(curl -s "$API_PATH/oauth-clients/local" | jq -r ".client_id")
|
||||||
client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
|
client_secret=$(curl -s "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
|
||||||
token=$(http -b --form POST "$API_PATH/users/token" \
|
token=$(curl -s "$API_PATH/users/token" \
|
||||||
client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
|
--data client_id="$client_id" \
|
||||||
username=$USERNAME \
|
--data client_secret="$client_secret" \
|
||||||
password=$PASSWORD \
|
--data grant_type=password \
|
||||||
|
--data response_type=code \
|
||||||
|
--data username="$USERNAME" \
|
||||||
|
--data password="$PASSWORD" \
|
||||||
| jq -r ".access_token")
|
| jq -r ".access_token")
|
||||||
## VIDEO UPLOAD
|
## VIDEO UPLOAD
|
||||||
http -b --form POST "$API_PATH/videos/upload" \
|
curl -s "$API_PATH/videos/upload" \
|
||||||
videofile@$FILE_PATH \
|
-H "Authorization: Bearer $token" \
|
||||||
channelId=$CHANNEL_ID \
|
--max-time 600 \
|
||||||
name=$NAME \
|
--form videofile=@"$FILE_PATH" \
|
||||||
"Authorization:Bearer $token"
|
--form channelId=$CHANNEL_ID \
|
||||||
|
--form name="$NAME"
|
||||||
/videos/imports:
|
/videos/imports:
|
||||||
post:
|
post:
|
||||||
summary: Import a video
|
summary: Import a video
|
||||||
|
|
Loading…
Reference in New Issue