HTTP POST requests from command line with curl
One of our customers have a JBoss application which they wanted to monitor with a script (in the long run Heartbeat2). By making a specific HTTP POST request to which the answer is known, it is possible to check if the server is running as expected. The HTTP POST request consist of a header and a body. The header is automaticaly generate from the parameters you provide curl and the body is provided in the --data parameter.
The following is an example close to what I used, and beneath a description of the parameters used parameters:
curl --insecure \
--user monitor_user:heykcnhre \
--header extra-header:12345678 \
--include \
--data '
7
get_email
' https://localhost:5011/check
--insecureignores unverified SSL certificates--userauthentication information need to access the server and make the http request in the first place.--headerprovides extra header information. You can add as many of theese as you need.--includeincludes the header in the response (not only the body)
Curl takes many different parameters use man curl for more info.