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 /api/books/<id>

This form of the GET call will retrieve a single book resource item based on the <id> provided. In general the response's JSON object will be of the defined resource type, though a server might decide to add or remove certain fields based on the service's logic. For our API, we will return all the fields defined in our resource type.

Let's look at an example when we try to retrieve a book resource with id "1":

// Request 
GET "<URL>/api/books/1" 
 
// Response 
{ 
   "id": "1", 
   "title": "book1", 
   "link": "http://link-to-book-1.com" 
 } 

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