title: Spring resttemplate
body: <p>How to send POST request where must be query parameters in message body?</p>
  
  <p>I tried:</p>
  
  <pre><code>MultiValueMap&lt;String, String&gt; map = new LinkedMultiValueMap&lt;String, String&gt;();
  map.add("name", "xx");
  map.add("password", "xx");
  
  restTemplate.postForObject("URL", map, Response.class);
  </code></pre>
  
  <p>But it doesn't work. I want to send data into bitstamp api.</p>
  
  <p>EDIT: My spring bean seems:</p>
  
  <pre><code>&lt;bean id="restTemplate" class="org.springframework.web.client.RestTemplate"&gt;
      &lt;property name="messageConverters"&gt;
          &lt;list&gt;
              &lt;bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>EDIT 2: My code seems</p>
  
  <pre><code>List&lt;MediaType&gt; acceptableMediaTypes = new ArrayList&lt;MediaType&gt;();
  acceptableMediaTypes.add(MediaType.APPLICATION_JSON);// or any other
  
  HttpHeaders headers = new HttpHeaders();
  headers.setAccept(acceptableMediaTypes);
  
  HttpEntity&lt;String&gt; requestEntity = new HttpEntity&lt;String&gt;("key=XX&amp;nonce=XX&amp;signature=XX", headers);
  ResponseEntity&lt;AccountBalance&gt; responseEntity = restTemplate.exchange(
  "https://www.bitstamp.net/api/balance/", HttpMethod.POST, requestEntity, AccountBalance.class);
  </code></pre>
  
  <p>Response is now: Missing key, signature and nonce parameters</p>
  
  <p>But it should be: API key not found</p>