Curl

Curl

Default to GET.

If --data/-d is specified defaults to POST.

POST

POST

Post example

Long form

curl --request POST http://example.com/api/endpoint \
     --header "Content-Type: application/json" \
     --data '{"key1": "value1", "key2": "value2"}'

Short form

curl -X POST http://example.com/api/endpoint \
     -H "Content-Type: application/json" \
     -d '{"key1": "value1", "key2": "value2"}'