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

Curl takes many different parameters use man curl for more info.

Creative Commons License
HTTP POST requests from command line with curl by Jacob Emcken is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.