title: Android - Return a book's ID using Google BooksAPI
body: <p>I am using Google Books API to display a list of various books by searching for terms, queries....</p>
  
  <p>So far everything is working as it is supposed to be, one problem though, I need to get a book by it's id, I believe the problem is with my <code>BookResponse</code> class</p>
  
  <p><strong>UPDATE</strong> I figured I should add a Serialized id in <code>BookItems</code> class but I don't know where to go from there</p>
  
  <p>PS. below you will find every class and a an image attached to display the JSON structure</p>
  
  <p><strong>Search in MainActivity</strong></p>
  
  <pre><code>ApiInterface apiService =
              RetrofitInstance.getRetrofitInstance().create(ApiInterface.class);
  
      retrofit2.Call&lt;BookResponce&gt; call = apiService.getBooksById("zyTCAlFPjgYC", BOOKS_API_KEY);
      call.enqueue(new Callback&lt;BookResponce&gt;() {
          @Override
          public void onResponse(retrofit2.Call&lt;BookResponce&gt; call, Response&lt;BookResponce&gt; response) {
              bookResp = response.body();
              for (int i = 0; i == 0; i++){
                  bookList.add(i, bookResp.getBooks().get(i).getBookData());
              }
  
              cAdapter.notifyDataSetChanged();
          }
  
          @Override
          public void onFailure(retrofit2.Call&lt;BookResponce&gt; call, Throwable t) {
              Toast.makeText(this, "failed", Toast.LENGTH_LONG).show();
          }
      });
  </code></pre>
  
  <p><strong>BookResponse class</strong></p>
  
  <pre><code>public class BookResponce {
      @SerializedName(value="items")
      ArrayList&lt;BookItems&gt; bookItems;
  
      @SerializedName(value="totalItems")
      int totalItems;
  
      public int getTotalItems() { return totalItems; }
      public ArrayList&lt;BookItems&gt; getBooks() { return bookItems; }
  }
  </code></pre>
  
  <p><strong>BookItems class</strong></p>
  
  <pre><code>public class BookItems {
      //This is what I added
      @SerializedName(value = "id")
      String id;
  
      @SerializedName(value="volumeInfo")
      Book bookData;
  
      //and this...
      public String getId() {
          return id;
      }
  
      public Book getBookData(){return bookData; }
  }
  </code></pre>
  
  <p><strong>API Interface class</strong></p>
  
  <pre><code>public interface ApiInterface {
  
      @GET("volumes/{id}")
      Call&lt;BookResponce&gt; getBooksById(@Path("id") String bookId, 
          @Query("API_KEY") String apiKey);
  
      @GET("volumes")
      Call&lt;BookResponce&gt; getBooksByQuery(@Query("q") String query, 
          @Query("API_KEY") String apiKey, @Query("maxResults") int maxResults);
  }
  </code></pre>