title: How to do post request to external api using rest template?
body: <p>While I am executing this i getting an error like this (&quot;Content type 'text/plain;charset=UTF-8' not supported]&quot;). Please help me to get this problem resolved.</p>
  <pre><code>public String saveCourse(CourseEntity courseDetails ) {
          HttpHeaders headers = new HttpHeaders();
            headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
            HttpEntity&lt;CourseEntity&gt; entity = new HttpEntity&lt;CourseEntity&gt;(courseDetails,headers);
  
            return restTemplate.exchange(
               &quot;http://localhost:8062/courses&quot;, HttpMethod.POST, entity, String.class).getBody();
  
      }
  </code></pre>