Menu
Coddy logo textTech

PUT and DELETE

Lesson 36 of 47 in Coddy's Networking with the Terminal course.

-X sets the method explicitly, which is how you reach the rest of them:

curl -s -X DELETE http://127.0.0.1:9126/item/7

PUT means store this at this exact location. It is idempotent: sending the same PUT five times leaves the same result as sending it once, because you are specifying the final state rather than an action.

POST is not idempotent. Five POSTs to /orders may well create five orders. That distinction is exactly why browsers warn before re-submitting a form, and why a retry after a timeout is safe for PUT and risky for POST.

DELETE removes the thing at that path, and is idempotent too: deleting something already gone leaves it gone.

challenge icon

Challenge

Hard

Send a DELETE and read the request line back.

  1. Start the capture listener on port 9126
  2. Send a DELETE to http://127.0.0.1:9126/item/7
  3. Print the first line of req.txt

Expected output:

DELETE /item/7 HTTP/1.1

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Networking with the Terminal

Practice on your own: Terminal playground