title: Login using Http Post android given custom api
body: <p>I am trying to login to a site using a login form and submit button in my app. I have been given the following api information: </p>
  
  <p>the api has been set up at  <a href="http://consumer.api.terrydev.terryinc.com" rel="nofollow">consumer.api.mobodev.terryinc.com</a></p>
  
  <p>Using this api I am trying to login using a username. The following information has been provided for the api call: </p>
  
  <blockquote>
    <p>Login with Username The Login with Username service is provided for
    existing Consumers to login using their username and password. The
    username will be either an email address or mobile phone number
    depending on how the Consumer had initially registered.  Login with
    Username will typically be used when logging into a second or
    subsequent Device, or via the browser etc.  This is because in the
    normal process flow, a Consumer will register and the Access Token
    will be returned and cache by the Client Application.  The Access
    Token is then used when starting the application instead of getting
    the Consumer to log in again. Calling the Login with Username logs the
    Consumer into the system and creates and returns a valid OAuth Access
    Token.  The returned OAuth Access Token can then be used in for
    subsequent API calls to identify the Consumer of the Client
    Application. Attributes 
    Attribute Value </p>
  </blockquote>
  
  <ul>
  <li>Path /v3/logins Support</li>
  <li>Formats JSON, XML HTTP </li>
  <li>Method POST </li>
  <li>Secure No </li>
  <li>Rate Limited </li>
  <li>No Cache</li>
  <li>Timeout TBC 
  -HTTP Codes 200 - OK 
  400 - Bad Request.<br>
  500 - Internal Server Error.</li>
  </ul>
  
  <p>Below is the code that I have written in the main activity: </p>
  
  <pre><code> HttpClient httpclient = new DefaultHttpClient();
  
  **HttpPost httppost = new HttpPost("consumer.api.mobodev.terryinc.com");**
  
  
      try {
          // Add user name and password
       EditText uname = (EditText)findViewById(R.id.username);
       String username = uname.getText().toString();
  
       EditText pword = (EditText)findViewById(R.id.password);
       String password = pword.getText().toString();
  
          List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(3);
          nameValuePairs.add(new BasicNameValuePair("grant_type","password"));
          nameValuePairs.add(new BasicNameValuePair("username", username));
          nameValuePairs.add(new BasicNameValuePair("password", password));
          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
          // Execute HTTP Post Request
          Log.w("Post", "Execute HTTP Post Request");
          HttpResponse response = httpclient.execute(httppost);
  
          String str = inputStreamToString(response.getEntity().getContent()).toString();
          Log.w("Before Post", str.toString());
  </code></pre>
  
  <p>My question is did I use the correct url when creating my httpPost object? </p>
  
  <p>Please help as I have no idea how to interpret the api documentation. </p>