I researched a little about the REST API model, but among many questions I had, I had one that is essentially important.
The staff always gave examples of model routes similar to this:
https://api.dominio.com.br/account[/{id}]
GET -> obtem o(s) usuário(s)
POST -> insere um novo usuário
PUT -> atualiza o usuário
DELETE -> remove o usuário
So far it works very well, I have the option to handle all users or only one, but only through the ID.
@Edit
If possible, I would also like to know the following: In somewhat less abstract operations such as sending a password recovery email, the processes required to do this must be done in the client application (which would have to do several API requests ) or should you create a route that when the call performs all necessary operations and delivers a ready response to the client application?
The operations to send a password recovery email, are more or less in the model below:
- Checks whether the user exists;
- Checks if the recovery code generated by the application has already been generated before for another user, to avoid duplicate codes;
- Registers the recovery code;
- Obtain the email template for password recoveries;
- Send the email.