title: How to use the @GET method to make API call?
body: <p>I'm trying to make a call to youtube data API to retrieve the subscriber count of a particular channel. But I don't know how to implement the API interface and define the endpoints so I pasted my whole remaining URL in the @GET method. But my app is crashing when  started.</p>
  
  <p>My complete URL is: <a href="https://www.googleapis.com/youtube/v3/channels?part=statistics&amp;id=+UC-lHJZR3Gqxm24_Vd_AJ5Yw&amp;key=AIzaSyAyON6YdgkFrtNHrGGs3IFS4groadJhhts" rel="nofollow noreferrer">https://www.googleapis.com/youtube/v3/channels?part=statistics&amp;id=+UC-lHJZR3Gqxm24_Vd_AJ5Yw&amp;key=AIzaSyAyON6YdgkFrtNHrGGs3IFS4groadJhhts</a></p>
  
  <p>Here is my interface :</p>
  
  <pre><code>public interface ApiInterface 
  {
      @GET("/channels?part=statistics&amp;id=+UC-lHJZR3Gqxm24_Vd_AJ5Yw&amp;key=AIzaSyAyON6YdgkFrtNHrGGs3IFS4groadJhhts")
      Call&lt;Mainjson&gt; getMainJson();
  }
  </code></pre>
  
  <p>Main Activity : </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity 
  {
      private Statistics statistics;
      private String subscribers;
      private TextView subscribersPreview;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          subscribersPreview=(TextView) findViewById(R.id.textView3);
  
          ApiInterface service = ApiClient.getClient().create(ApiInterface.class);
  
          Call&lt;Mainjson&gt; call = service.getMainJson();
  
          call.enqueue(new Callback&lt;Mainjson&gt;() {
              @Override
              public void onResponse(Call&lt;Mainjson&gt; call, Response&lt;Mainjson&gt; response) {
                  List&lt;Items&gt; items = response.body().getItems();
                  statistics=items.get(0).getStatistics();
                  subscribers=statistics.getSubscriberCount();
                  subscribersPreview.setText(subscribers);
              }
  
              @Override
              public void onFailure(Call&lt;Mainjson&gt; call, Throwable t) {
                  Toast.makeText(MainActivity.this,"Failed to retrieve data",Toast.LENGTH_SHORT).show();
              }
          });
  
      }
  }
  </code></pre>
  
  <p>The retrofit instance :</p>
  
  <pre><code>public class ApiClient {
  
      public static final String BASE_URL = "https://www.googleapis.com/youtube/v3";
      private static Retrofit retrofit = null;
  
  
      public static Retrofit getClient() {
          if (retrofit==null) {
              retrofit = new Retrofit.Builder()
                      .baseUrl(BASE_URL)
                      .addConverterFactory(GsonConverterFactory.create())
                      .build();
          }
          return retrofit;
      }
  }
  </code></pre>