mdawar.dev

A blog about programming, Web development, Open Source, Linux and DevOps.

Post JSON data Using Curl

bash
$curl -X POST https://example.com \
$-H 'Content-Type: application/json' \
$-d '{"name": "example"}'

curl options:

  • -X, --request: Specify request command to use (In this case POST)
  • -H, --header: Pass a custom header (The content type for this request)
  • -d, --data: HTTP POST data (The JSON object)