How to design REST API for email sending service by using POST, GET, PUT, DELETE?
send: POST - /email
retrieve: GET - /email/{id}
delete: DELETE - /email/{id}
Is it the correct way of designing REST API? I feel like it’s not intuitive to map POST to the action “send”.
The scheme you have given is correct. Alternatively you can use controllers to perform some more complex actions.
In your case it can look like this:
Note new controllers and the change creation works. The latter is rather subjective, but reasonable (as you cannot really access the URL of “no actual email” like I would interpret “
/email” without “{id}” part).Additional resources: