3 Http Methods - shijazi88/springboot GitHub Wiki

Http Methods

We will write examples using Http methods (Get, Post, Delete, Put)

  • create new user using PUT method: we will use @RequestBody to convert the http request body to object using Http message Convertor, one of the most commons used convertor is MappingJackson2HttpMessageConverter, this convertor is used to bind to typed beans, or untyped instances like Hashmap
  • Get all users using GET method
  • delete user using DELETE method: in this method, we will pass user id as path variable, @PathVariable is used to read path parameter
  • update user Information using POST method: same like PUT example we can use @RequestBody to read user information, then update Information