title: Unable to insert data using POST request - Spring REST
body: <p>I am making a simple project that uses a Spring RESTApi. I tried to insert data into database using POST request but unfortunately got error there. 
  I am using Postman for API request.</p>
  
  <p>All other request get, delete and put works fine but post doesn't work.</p>
  
  <p>i have tried inserting data manually without using api but that works fine for me.</p>
  
  <p>The error is;</p>
  
  <p><a href="https://i.stack.imgur.com/QyIoA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QyIoA.png" alt="Error"></a></p>
  
  <pre><code>@RequestMapping(value = "/create", method = RequestMethod.POST)
      public ResponseEntity&lt;Void&gt; createUser(@RequestBody User user, UriComponentsBuilder ucBuilder) {
          try {
              userService.insert(user);
          } catch (HibernateException e) {
              System.out.println(e);
              return new ResponseEntity&lt;&gt;(HttpStatus.NOT_FOUND);
          }
  
          HttpHeaders headers = new HttpHeaders();
          headers.setLocation(ucBuilder.path("/user/{id}").buildAndExpand(user.getUserId()).toUri());
          return new ResponseEntity&lt;&gt;(headers, HttpStatus.CREATED);
      }
  </code></pre>
  
  <p><strong>POSTMAN</strong>
  <a href="https://i.stack.imgur.com/MbBB4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MbBB4.png" alt="enter image description here"></a></p>
  
  <p>Thanks!!!!!!!!!!!!!!</p>