Image upload via curl
works perfectly, but not for videos.
The imgur api documentation is outdated does not seem to work with video files.
The video file is fairy small, it's .mp4 file and the imgur api simply returns null
errorcode.
Check the windows curl
example below.
Before testing the code below, remember:
- Insert your Client-ID into
YOUR_CLIENT_ID
- Adjust the file path of
-F "video=@
- Requirements
curl
:- Latest Windows 10 operating system that includes
curl.exe
binary. - Linux Distribution with
curl
binary.
- Latest Windows 10 operating system that includes
Windows Batch script example.
save it with a file extension yourfilename.bat
or yourfilename.cmd
@ECHO OFF
curl --request POST --url "https://api.imgur.com/3/image" --header "Authorization: Client-ID YOUR_CLIENT_ID" --header "content-type: multipart/form-data;" -F "name=testuploadname" -F "description=sdfdsf" -F "type=file" -F "video=@C:\Users\Windows10\Desktop\5757578.mp4" -F "disable_audio=1"
PAUSE
Output, video upload failed due to null
errorcode:
{"data":{"errorCode":null,"ticket":"0c328b47"},"success":true,"status":200}
CodePudding user response:
curl -X POST -H "Authorization: Bearer YOURTOKEN" -F "video=@C:\Users\Windows10\Desktop\75427.mp4" https://api.imgur.com/3/upload