hey !
I’m not a programmer but I would like top upload files to my peertube instance using the API. I’m using this example of the peertube doc.
## DEPENDENCIES: httpie, jq
# pip install httpie
USERNAME="<your_username>"
PASSWORD="<your_password>"
FILE_PATH="<your_file_path>"
CHANNEL_ID="<your_channel_id>"
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 \
"Authorization:Bearer $token"
But I don’t find a way to give a path and a name with spaces (even using \
). When I do, I have this error :
##with
FILE_PATH="/example test.mp3"
## Or with
FILE_PATH=/example\ test.mp3
##I get
http: error: argument REQUEST_ITEM: "test.mp3" is not a valid value
thx for your help