Currently I am connecting from android to a .net WEB API using HttpClient and I have been able to do a GET and POST to read/write data. However I want to do an Update and a Delete.
I tried to do this using a POST, but it simple creates more records. Here is my code for the POST, how would I change it to do a PUT or DELETE instead?
        HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://mywebsite.net/api/employees/6");
    try {
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);
        nameValuePairs.add(new BasicNameValuePair("firstName", "UpdatedHello"));
        nameValuePairs.add(new BasicNameValuePair("lastName", "World"));
        nameValuePairs.add(new BasicNameValuePair("employee_name", "UpdatedHello World"));
        nameValuePairs.add(new BasicNameValuePair("password", "xxx"));
        nameValuePairs.add(new BasicNameValuePair("isActive", "1"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);
 
     
    