title: Android Rest Client
body: <p>I found so many samples for requesting a REST API, but all together are confusing, can some one please explain me a way to use http requests.</p>
  
  <p>My Requirement is, I want to get data from a REST API by providing username, pwd and a key.</p>
  
  <p>What I have Used was,</p>
  
  <pre><code>        HttpClient client = new DefaultHttpClient();  
          HttpPost post = new HttpPost("REST API url"); 
          post.setHeader("Content-type", "application/json");
  
          JSONObject obj = new JSONObject();
          obj.put("username", "un");
          obj.put("pwd", "password");
          obj.put("key","123456");
  
          post.setEntity(new StringEntity(obj.toString(), "UTF-8"));
          HttpResponse response = client.execute(post);
  </code></pre>
  
  <p>But the response is always null and these working fine when tested with browser tool by posting the same data.Is some thing wrong with my approach? please suggest me the correct way. Thank you </p>