I am developing an application and want to send the content with the HttpPut request. I am sending it but it is not recognized to the remote server. I am sending the request to the REST API.
Here Is my Code:
HttpURLConnection connection;
try{
URL url = new URL(Constants.url_domain+"listings/"+idvalue);
//URL url = new URL(imageUrl);
HttpPut httpRequest = null;
httpRequest = new HttpPut(url.toURI());
String basicAuth = "Basic " + new String(Base64.encode("username:password123#".getBytes(),Base64.NO_WRAP ));
httpRequest.setHeader("Authorization", basicAuth);
MultipartEntity entity2 = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity2.addPart("title",new StringBody(titlevalue));
entity2.addPart("price",new StringBody(pricevalue));
entity2.addPart("active",new StringBody("false"));
httpRequest.setEntity(entity2);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
}