POST request to config webhook in java



Hi all,

i have a problem when i try to config a new webhook for my api. Im using Java and i do it like this:

HttpClient httpclient = HttpClients.createDefault();
                  HttpPost httppost =
                      new HttpPost("");

                  // Parameters
                  String rute = url + "/api/webhook";
                  List <NameValuePair> parameters = new ArrayList <NameValuePair>();
                  parameters.add(new BasicNameValuePair("url", rute));
                  httppost.setEntity(new UrlEncodedFormEntity(parameters, "UTF-8"));

                  // OAUTH
                  OAuthConsumer consumer = new CommonsHttpOAuthConsumer("XX",
                  consumer.setTokenWithSecret("XX", "XX");

                  // Execute and get the response
                  HttpResponse response = httpclient.execute(httppost);

when i execute this i get a 400 bad response. Any ideas? if i try to execute a request in postman it works perfect if i put the url parameter in “x-www-form-urlencoded”, but in java i cant. I have other method that delete a webhook working, but it havent url parameter…