I have a User
entity that looks like the following:
class UserVM {
id: number;
name: string;
email: string;
}
There is a REST API to work with the list of users, where we can get the list an update an individual user by ID:
GET /api/users
PUT /api/users/1 { name: ..., email: ... }
Now, I need to add a checkbox to the user editor form, which says "Send changes report". If it is checked, the updated user receives an email saying "Your profile has been updated".
This checkbox is definitely not related to the User
model, and I am wondering how to properly represent it in the API. Here are the few options I considered:
- Separate
UserVM
andEditUserVM
, add a new flag to the latter and use it forPUT
requests - Add a different non-rest method that just sends the email, call it from the client after update
- Add a query parameter like
PUT /api/user/1?send=1 { ... }
What is the best practice for such cases?