Jump to the navigation menu

Sending POST requests with curl

curl --header "Content-Type: application/json" \
  --insecure \
  --data '{"foo": "bar"}' \
  https://example.docker.localhost/webhook

--request POST is implied if --data is passed.

--insecure skips SSL validation, e.g. if using a self-signed certificate.

Also, from man curl:

--json works as a shortcut for passing on these three options:

--data [arg]
--header "Content-Type: application/json"
--header "Accept: application/json"

About me

Picture of Oliver

I'm an certified Drupal Triple Expert with 18 years of experience, a Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.