Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
)
 
PREVIOUS NEXT
Tagged: #Batch #programming #check #http #call #status
ADD COMMENT
Topic
Name
9+9 =