The 'api' command requires root access to run, which I know I would rather not give to a monitoring tool. The cURL call definitely works, though. You get a 503 when the API is down, and a 400 when the API is up. Zero authentication needed:
[Expert@TestSC]# api stop
2024-May-24 13:36:05 - Stopping API ...
2024-May-24 13:36:07 - API stopped successfully.
[Expert@TestSC]# curl_cli -vkX POST https://127.0.0.1/web_api/login
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 443 (#0)
* ALPN, offering http/1.1
* *** Current date is: Fri May 24 13:36:21 2024
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* err is -1, detail is 2
* *** Current date is: Fri May 24 13:36:21 2024
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* servercert: Activated
* servercert: CRL validation was disabled
* Server certificate:
* subject: L=Locality Name (eg, city); CN=169.254.0.1; emailAddress=Email Address; unstructuredName=An optional company name
* start date: May 19 16:16:45 2024 GMT
* expire date: May 19 16:16:45 2034 GMT
* issuer: L=Locality Name (eg, city); CN=169.254.0.1; emailAddress=Email Address; unstructuredName=An optional company name
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* servercert: Finished
< HTTP/1.1 503 Service Unavailable
< Date: Fri, 24 May 2024 13:36:21 GMT
< Server: CPWS
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-Frame-Options: SAMEORIGIN
< Content-Length: 299
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Unavailable</title>
</head><body>
<h1>Service Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
</body></html>
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, close notify (256):
[Expert@TestSC]# api start
2024-May-24 13:36:29 - Starting API ...
2024-May-24 13:36:31 - API started successfully.
[Expert@TestSC]# curl_cli -vkX POST https://127.0.0.1/web_api/login
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 443 (#0)
* ALPN, offering http/1.1
* *** Current date is: Fri May 24 13:37:51 2024
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* err is -1, detail is 2
* *** Current date is: Fri May 24 13:37:51 2024
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* servercert: Activated
* servercert: CRL validation was disabled
* Server certificate:
* subject: L=Locality Name (eg, city); CN=169.254.0.1; emailAddress=Email Address; unstructuredName=An optional company name
* start date: May 19 16:16:45 2024 GMT
* expire date: May 19 16:16:45 2034 GMT
* issuer: L=Locality Name (eg, city); CN=169.254.0.1; emailAddress=Email Address; unstructuredName=An optional company name
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* servercert: Finished
< HTTP/1.1 400 Bad Request
< Date: Fri, 24 May 2024 13:37:51 GMT
< Server: Jetty(9.2.9.v20150224)
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-Frame-Options: SAMEORIGIN
< Content-Type: application/json
< X-UA-Compatible: IE=EmulateIE8
< X-Forwarded-Host-Port: 443
< Connection: close
< Transfer-Encoding: chunked
<
{
"code" : "generic_err_invalid_syntax",
"message" : "Login request message processing failed"
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, close notify (256):
}[Expert@TestSC]#