mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:06:30 +00:00
29 lines
819 B
Batchfile
29 lines
819 B
Batchfile
setlocal enabledelayedexpansion
|
|
|
|
set API_URL=https://api.azaion.com
|
|
set SOURCE_FILE=%1
|
|
set DESTINATION=%2
|
|
|
|
set "SOURCE_FILE=%SOURCE_FILE:\=/%"
|
|
|
|
set EMAIL=uploader@azaion.com
|
|
set PASSWORD=Az@1on_10Upl0@der
|
|
|
|
for /f "tokens=*" %%i in ('curl -s -X POST -H "Content-Type: application/json" ^
|
|
-d "{\"email\":\"%EMAIL%\",\"password\":\"%PASSWORD%\"}" %API_URL%/login') do set RESPONSE=%%i
|
|
|
|
for /f "tokens=2 delims=:" %%a in ('echo %RESPONSE% ^| findstr /i "token"') do (
|
|
set "TOKEN=%%a"
|
|
set "TOKEN=!TOKEN:~1,-1!"
|
|
set "TOKEN=!TOKEN:~0,-2!"
|
|
)
|
|
|
|
set UPLOAD_URL=%API_URL%/resources/%DESTINATION%
|
|
|
|
echo Uploading %SOURCE_FILE% to %UPLOAD_URL%...
|
|
curl --location %UPLOAD_URL% ^
|
|
-H "Authorization: Bearer %TOKEN%" ^
|
|
-H "Content-Type: multipart/form-data" ^
|
|
--form "data=@%SOURCE_FILE%"
|
|
echo Upload complete!
|