title: Google Cloud Print Api not working
body: <p>Hello  i am trying with the google cloud print api according to the documentation available</p>
  
  <p><a href="https://developers.google.com/cloud-print/docs/appInterfaces" rel="nofollow">https://developers.google.com/cloud-print/docs/appInterfaces</a> site. </p>
  
  <p>My Source code is to call the google cloud print search API is :</p>
  
  <pre><code>@Override
      protected String doInBackground(String... arg0) {
          // TODO Auto-generated method stub
          BufferedReader in = null;
          String result2;
          try {
              HttpParams httpParameters = new BasicHttpParams();
  
              HttpConnectionParams.setConnectionTimeout(httpParameters, 15000);
              HttpConnectionParams.setSoTimeout(httpParameters, 15000);
  
              HttpClient client = new DefaultHttpClient(httpParameters);
              HttpPost request = new HttpPost("https://www.google.com/cloudprint/search?output=json");
  
  
            request.setHeader("access_token",token);
  
              List&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
  
              postParameters.add(new BasicNameValuePair("q","recent"));
              postParameters.add(new BasicNameValuePair("type",""));
              postParameters.add(new BasicNameValuePair("connection_status", ""));
              postParameters.add(new BasicNameValuePair("use_cdd", ""));
              postParameters.add(new BasicNameValuePair("extra_fields", ""));
  
  
              UrlEncodedFormEntity formEntity = null;
              try {
                  formEntity = new UrlEncodedFormEntity(postParameters);
  
  
              } catch (UnsupportedEncodingException e) {
                  e.printStackTrace();
              }
              request.setEntity(formEntity);
              HttpResponse response = null;
  
              try {
                  response = client.execute(request);
              } catch (ClientProtocolException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
              } catch (SocketException e1) {
  
                  e1.printStackTrace();
              }
  
              catch (IOException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
              }
  
              try {
                  in = new BufferedReader(new InputStreamReader(response
                          .getEntity().getContent()));
              } catch (IllegalStateException e) {
                  e.printStackTrace();
              } catch (Exception e) {
                  e.printStackTrace();
              }
              StringBuffer sb = new StringBuffer("");
              String line = "";
              String NL = System.getProperty("line.separator");
              try {
                  while ((line = in.readLine()) != null) {
                      sb.append(line + NL);
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              } catch (Exception e) {
              }
              try {
                  in.close();
              } catch (IOException e) {
                  e.printStackTrace();
              } catch (Exception e) {
              }
              result2 = sb.toString();
  
          } finally {
              if (in != null) {
                  try {
                      in.close();
                  } catch (IOException e) {
                      e.printStackTrace();
                  } catch (Exception e) {
                  }
              }
          }
  
          Log.d("result is::", result2);
  
          return result2;
      }
  </code></pre>
  
  <p>Where token is the getting from the google+ login api.</p>
  
  <p>I have also try to set the header with </p>
  
  <pre><code>request.setHeader("Authorization", "OAuth "+token);
  </code></pre>
  
  <p>But all time it is showing the Html output:</p>
  
  <pre><code>&lt;HTML&gt;
   &lt;HEAD&gt;
   &lt;TITLE&gt;User credentials required&lt;/TITLE&gt;
   &lt;/HEAD&gt;
   &lt;BODY BGCOLOR="#FFFFFF" TEXT="#000000"&gt;
   &lt;H1&gt;User credentials required&lt;/H1&gt;
   &lt;H2&gt;Error 403&lt;/H2&gt;
  &lt;/BODY&gt;
   &lt;/HTML&gt;
  </code></pre>
  
  <p>Can anybody help me out regarding this. </p>