Skip to content
curl

HTTP Methods

GET, POST, PUT, and DELETE requests.

#method#get#post

Code

curl
# GET (default)
curl https://api.example.com/users

# POST with JSON body
curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice"}'

# PUT
curl -X PUT https://api.example.com/users/1 \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice2"}'

# DELETE
curl -X DELETE https://api.example.com/users/1