title: Get STRING response from restTemplate.put
body: <p>I'm having a problem using Spring restTemplate.</p>
  
  <p>For now i'm sending a PUT request for a restful service and that restful service send me back important informations in response.</p>
  
  <p>The question is that <strong>restTemplate.put</strong> are a <em>void</em> method and not a <em>string</em> so i can't see that response.</p>
  
  <p>Following some answers i've change my method and now i'm using <strong>restTemplate.exchange</strong>, here are my method:</p>
  
  <pre><code>public String confirmAppointment(String clientMail, String appId)
  {
      String myJsonString = doLogin();
  
      Response r = new Gson().fromJson(myJsonString, Response.class);
  
      // MultiValueMap&lt;String, String&gt; map;
      // map = new LinkedMultiValueMap&lt;String, String&gt;();
  
      // JSONObject json;
      // json = new JSONObject();
  
      // json.put("status","1");
  
      // map.add("data",json.toString());
  
      String url = getApiUrl() + "company/" + getCompanyId() + "/appointment/" + appId + "?session_token=" + r.data.session_token;
      String jsonp = "{\"data\":[{\"status\":\"1\"}]}";
  
      RestTemplate rest = new RestTemplate();
  
      HttpHeaders headers = new HttpHeaders();
      headers.add("Content-Type", "application/json");
      headers.add("Accept", "*/*");
  
      HttpEntity&lt;String&gt; requestEntity = new HttpEntity&lt;String&gt;(jsonp, headers);
      ResponseEntity&lt;String&gt; responseEntity = 
              rest.exchange(url, HttpMethod.PUT, requestEntity, String.class);
  
      return responseEntity.getBody().toString();
  }
  </code></pre>
  
  <p>Using the method above, i receive a <strong>400 Bad Request</strong></p>
  
  <p>I know my parameters, url and so, are just fine, cause i can do a <strong>restTemplate.put</strong> request like this:</p>
  
  <pre><code>try {
      restTemplate.put(getApiUrl() + "company/" + getCompanyId() + "/appointment/" + appId + "?session_token=" + r.data.session_token, map);
  } catch(RestClientException j)
  {
      return j.toString();
  }
  </code></pre>
  
  <p>The problem (like i said before) is that the try/catch above does not return any response but it gives me a <em>200</em> response.</p>
  
  <p>So now i ask, what can be wrong?</p>