Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestController
- @RequestMapping("/v3/users")
- public class UserController {
- ...
- @RequestMapping(value = "/{userId}/reset_password", method = RequestMethod.POST)
- @ResponseBody
- public ResponseEntity<Void> resetPassword(
- @PathVariable("userId") Long userId, @RequestBody UserPasswordResetRequestDTO data,) {
- // Logic here
- return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
- }
- }
- public class UserPasswordResetRequestDTO {
- private Long userId;
- private String oldPassword;
- private String newPassword;
- // Getters and setters
- }
- POST /v3/users/6/reset_password HTTP/1.1
- Host: localhost:8080
- Content-Type: application/json
- Cache-Control: no-cache
- Postman-Token: 8afe6ef8-a4cd-fc9d-a6cc-b92766a56bd6
- {"oldPassword":"actualPassword", "newPassword":"newOne"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement