Android HTTP POST params send but server doesn't get it

Calling of API

    HttpUriRequest httpRequest = null;
    HttpPost request = new HttpPost(url);

    String postParameters = "email=" + email + "&name=" + name;

    StringEntity stringEntity = new StringEntity(postParameters, "UTF-8");

    httpRequest = request;

    response = client.execute(httpRequest);

I am not getting post params at server side. Get param works. The same API works from other REST clients but not from android.


Variable httpRequest is useless. Is variable postParameters a String?

Here example of sending post to upload image with some params.

HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
HttpPost httppost = new HttpPost(getString(R.string.url));

try {
    MultipartEntityBuilder builder = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE);

    builder.addPart("picture", new FileBody(mSharedImagePath, ContentType.create("image/jpeg")));

    // Adding params
    List<NameValuePair> params = new ArrayList<NameValuePair>();

    params.add(new BasicNameValuePair("param1", "utf-8 encoded text");
    params.add(new BasicNameValuePair("param2", "another utf-8 encoded text");

    for (NameValuePair param : params) {
        builder.addTextBody(param.getName(), param.getValue(), ContentType.create("text/plain", Charset.forName("UTF-8")));


    HttpResponse response = httpclient.execute(httppost);

    HttpEntity resEntity = response.getEntity();

} catch (FileNotFoundException e) {
} catch (ClientProtocolException e) {
} catch (IOException e) {
} catch (Exception e) {

In your code it can be like this

HttpPost request = new HttpPost(url);

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();  
nameValuePairs.add(new BasicNameValuePair("email","my email"));  
nameValuePairs.add(new BasicNameValuePair("name","my name"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

response = client.execute(request);

Need Your Help

Python split dataframe column with pipe

python regex pipe

Suppose I have a pandas data frame df

How to delete connection in draw2d.js?

javascript draw2d-js

I want to delete a connection between two objects in draw2d.js. I am trying to find direct method that delete a connection but i did not found it. So please tell me if any way or is there any method