Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. @RestController
  2. @RequestMapping("/v3/users")
  3. public class UserController {
  4.  
  5. ...
  6.  
  7. @RequestMapping(value = "/{userId}/reset_password", method = RequestMethod.POST)
  8. @ResponseBody
  9. public ResponseEntity<Void> resetPassword(
  10. @PathVariable("userId") Long userId, @RequestBody UserPasswordResetRequestDTO data,) {
  11. // Logic here
  12. return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
  13. }
  14. }
  15.  
  16. public class UserPasswordResetRequestDTO {
  17.  
  18. private Long userId;
  19. private String oldPassword;
  20. private String newPassword;
  21.  
  22. // Getters and setters
  23.  
  24. }
  25.  
  26. POST /v3/users/6/reset_password HTTP/1.1
  27. Host: localhost:8080
  28. Content-Type: application/json
  29. Cache-Control: no-cache
  30. Postman-Token: 8afe6ef8-a4cd-fc9d-a6cc-b92766a56bd6
  31.  
  32. {"oldPassword":"actualPassword", "newPassword":"newOne"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement