title: Android Retrofit error while building a request
body: <p>I was wondering if anyone could tell me why I am getting a bad request error when I attempt to perform a RESTfull service using Retrofit</p>
  
  <p>Error : HTTP/1.1 400 Bad Request</p>
  
  <p>Here are my two classes:</p>
  
  <p>RetrofitInterface:</p>
  
  <pre><code>public class RetrofitInterface {
      private static StockApiInterface sStockService;
  
      public static StockApiInterface getStockApiClient() {
          if (sStockService == null) {
              RestAdapter restAdapter = new RestAdapter.Builder()
                      .setEndpoint("http://query.yahooapis.com/v1/public")
                      .build();
              sStockService = restAdapter.create(StockApiInterface.class);
          }
  
          return sStockService;
      }
  
      public interface StockApiInterface {
          @GET("/yql")
          void listQuotes(@Query("q") String query,Callback&lt;Stock&gt; stockInfo);
      }
  
  
  }
  </code></pre>
  
  <p>Asyntask within MainActivity</p>
  
  <pre><code>public class extraThread extends AsyncTask&lt;Void, Void, Void&gt;{
  
      @Override
      protected Void doInBackground(Void... params) {
          // TODO Auto-generated method stub
          RetrofitInterface.getStockApiClient().listQuotes("select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(\"AIB.IR\")%0A%09%09&amp;format=json&amp;diagnostics=true&amp;env=http%3A%2F%2Fdatatables.org%2Falltables.env&amp;callback=", new Callback&lt;Stock&gt;() {
  
  
              @Override
              public void failure(RetrofitError arg0) {
                  // TODO Auto-generated method stub
                  arg0.printStackTrace();
              }
  
              @Override
              public void success(Stock arg0, Response arg1) {
                  // TODO Auto-generated method stub
  
              }
          });
  
      }
  
  }
  </code></pre>
  
  <p>The result is always a failure. I thought originally that the problem was Retrofit's built in gson converter was having trouble converting the response to a stock object, as I was only receiving a "Retrofit.retrofiterror' response. However the 'Bad Request' response has me thinking the problem is in the URL for the api.
  Here is my desired response url:</p>
  
  <p><code>http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AIB.IR%22)%0A%09%09&amp;format=json&amp;diagnostics=true&amp;env=http%3A%2F%2Fdatatables.org%2Falltables.env&amp;callback=</code></p>
  
  <p>Could anyone tell me if I am building this correctly in my code? One possible issue is that I escape my quotations in the query. Maybe this is causing problems?</p>
  
  <p>Just in case I will post my Stock object. I wrote this with the help of an online POJO converter</p>
  
  <pre><code>public class Stock {
  
      @Expose
      private Query query;
  
      public Query getQuery() {
          return query;
      }
  
  
      public void setQuery(Query query) {
          this.query = query;
      }
  
  }
  </code></pre>
  
  <p>Any help on this would be greatly appreciated.</p>