You can refer to this question about PATCH vs PUT.
Let's say you are just changing the online status of the user. In that case it might be better to go with PATCH and have the change reflected on a path variable.
For example:
@PatchMapping("user/{id}/{status}")
public boolean setStatus(@PathVariable id, @PathVariable status) {
User currentUser = userRepo.findOne(id);
currentUser.setStatus(status);
userRepo.save(currentUser);
// ...
}
If the intention is to make changes to an undefined number of fields, you can go with PUT, have the data in the request body and use the DTO pattern. You can find a lot of examples on the web about the DTO pattern. In this case, the code would be as below.
@PatchMapping("user/{id}")
public boolean updateUser(@PathVariable id, @RequestBody UserDTO userDTO) {
// UserMapper is the mapper class which returns you a new User
// populated with the data provided in the data transfer object.
User user = UserMapper.makeUser(userDTO);
userRepo.update(id, user);
// ...
}