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/7PUT 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
HardSend a DELETE and read the request line back.
- Start the capture listener on port 9126
- Send a DELETE to
http://127.0.0.1:9126/item/7 - Print the first line of
req.txt
Expected output:
DELETE /item/7 HTTP/1.1Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Networking with the Terminal
4Is It Reachable?
ICMP and pingReading Ping OutputWhen Ping LiesRefused or Timed OutRecap: Reachability7Sending Data
POST with -dWhat -d Actually SendsForm EncodingSending JSONPUT and DELETERecap: Writing DataPractice on your own: Terminal playground