O'Reilly logo

Distributed Computing with Go by V.N. Nikhil Anurag

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DELETE

Assuming that we have a book with the id "2", we can delete it using cURL, as follows:

$ # We can make other method calls by providing -X flag with method name in caps. 
$ curl -LX DELETE localhost:8080/api/books/2 | jq  # DELETE a resource. 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current 
                                 Dload  Upload   Total   Spent    Left  Speed 
100     2  100     2    0     0    337      0 --:--:-- --:--:-- --:--:--   400 
[] 
$ curl -L localhost:8080/api/books | jq # GET all books after resource deletion. 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current 
                                 Dload  Upload   Total   Spent    Left  Speed 
100    46  100    46    0     0  21465      0 --:--:-- --:--:-- --:--:-- 46000 
100   249  100   249    0     0  91008      0 --:--:-- --:--:-- --:--:-- 91008 
[ 
  { 
    "id": "5", 
    "title": "Book-5", 
 "link": ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required