title: Make an HttpPost with params and Body
body: <p>I need to replicate a Postman POST in Java.
  Usually I had to make an HttpPost with only params in URL, so it was easy to build:</p>
  
  <pre><code>ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
  postParameters.add(new BasicNameValuePair("username", username));
  post.setEntity(new UrlEncodedFormEntity(postParameters, Consts.UTF_8));
  </code></pre>
  
  <p>But what I have to do if I have a POST like the image below where there are Params in URL and Body TOGETHER??
  <a href="https://i.stack.imgur.com/W2BKX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W2BKX.png" alt="POST call with Params and Body"></a>
  Now I'm making the HttpPost like this:</p>
  
  <pre><code>HttpClient client = HttpClientBuilder.create().build();
  HttpPost post = new HttpPost("someUrls.com/upload");
  ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
  postParameters.add(new BasicNameValuePair("username", username));
  postParameters.add(new BasicNameValuePair("password", password));
  postParameters.add(new BasicNameValuePair("owner", owner));
  postParameters.add(new BasicNameValuePair("destination", destination));
  try{
      post.setEntity(new UrlEncodedFormEntity(postParameters, Consts.UTF_8));
      HttpResponse httpResponse = client.execute(post);
      //Do something
  }catch (Exception e){
      //Do something
  }
  </code></pre>
  
  <p>But how I put "filename" and "filedata" params in the Body together with the params in the URL?
  Actually I'm using org.Apache library, but i could consider also others library.</p>
  
  <p>Thanks to anybody that will help!</p>