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

GET

Let's now look at cURL commands to make HTTP requests. Depending on the state of your server, the output on making the GET Request might be different:

$ # List all books on server 
$ # Note that we use '-L' flag while using cURL. 
$ # This takes care of any http redirections that might be required. 
$ curl -L localhost:8080/api/books | jq  # GET CALL 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current 
                                 Dload  Upload   Total   Spent    Left  Speed 
100    46  100    46    0     0   9721      0 --:--:-- --:--:-- --:--:-- 11500 
100   311  100   311    0     0  59589      0 --:--:-- --:--:-- --:--:-- 59589 
[ 
  { 
    "id": "3", 
    "title": "Book-3", 
    "link": "http://link-to-book3.com" 
  }, 
  { 
    "id": "4", 
    "title": "Book-4", 
    "link": "http://link-to-book4.com" 
  }, 
  { 
    "id": "5", 
 "title": ...

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