title: How to properly setup a POST spring rest template by passing in parameters and return json?
body: <p>I am a bit new to spring and I am having issues calling a rest service using post to a ur in spring by using spring templates
  I am not sure how to properly pass in data into the rest template and how to get json data out currently i get 415 unsupport media type error.</p>
  
  <p>So the RestservicesURL.signupurl = "abc.com/signup <br>
  the param would be = "name=john?email=john@doe.com?password=john" (which is acquired  by @RequestParam Map by spring)<br>
  The response I need to get is a JSON object and I am not sure how to do this;</p>
  
  <pre><code>public void signUp(Map&lt;String, String&gt; param) {
      try {
          callService(RestServicesUrl.SIGNUP_URL, param);
      } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Here is the rest template call    </p>
  
  <pre><code>public static void callService(String url, Map&lt;String, String&gt; data) throws Exception {
      List&lt;MediaType&gt; acceptableMediaTypes = new ArrayList&lt;MediaType&gt;();
      acceptableMediaTypes.add(MediaType.ALL);
  
      HttpHeaders headers = new HttpHeaders();
      headers.setAccept(acceptableMediaTypes);
      HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(headers); 
  
  
      RestTemplate rest = new RestTemplate();
  
      rest.postForObject(url, entity, byte[].class);              
  
  }
  </code></pre>