mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:16:30 +00:00
44 lines
1.1 KiB
Batchfile
44 lines
1.1 KiB
Batchfile
setlocal enabledelayedexpansion
|
|
@echo off
|
|
set CURRENT_DIR=%cd%
|
|
cd /d %~dp0..
|
|
|
|
set API_URL=https://api.azaion.com
|
|
set RESOURCES_FOLDER=%1
|
|
set EMAIL=uploader@azaion.com
|
|
set PASSWORD=Az@1on_10Upl0@der
|
|
|
|
set "UPLOAD_FILE="
|
|
for /f "delims=" %%i in ('dir /b /a-d "AzaionSuite.Iterative*"') do (
|
|
if not defined UPLOAD_FILE set "UPLOAD_FILE=%%i"
|
|
)
|
|
|
|
if not defined UPLOAD_FILE (
|
|
echo No matching file found.
|
|
exit /b
|
|
)
|
|
|
|
echo Logging in and retrieving token...
|
|
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!"
|
|
)
|
|
|
|
echo clear suite folder
|
|
|
|
curl -X POST %API_URL%/resources/clear/%RESOURCES_FOLDER% -d {} -H "Authorization: Bearer %TOKEN%"
|
|
|
|
echo Uploading files to resources...
|
|
|
|
curl --location %API_URL%/resources/%RESOURCES_FOLDER% ^
|
|
-H "Authorization: Bearer %TOKEN%" ^
|
|
-H "Content-Type: multipart/form-data" ^
|
|
--form "data=@%UPLOAD_FILE%"
|
|
|
|
cd /d %CURRENT_DIR%
|
|
echo Done!
|