Answers for "Batch programming check http call status"

0

Batch programming check http call status

SET SOME_URL="https://my/api/to/get/something"
SET HTTP=
for /f %%a in ( 'curl -k -s -o NUL -w "%%{http_code}" "%SOME_URL%"' ) do set HTTP=%%a
if "%HTTP%" == "200" (
  echo "SUCCESS."
  REM Do rest of you stuff here
) else (
  echo "FAIL."
  REM Do any kind of cleanups
  exit /b
)
Posted by: Guest on January-19-2022

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language