3 ms·
A POST to /email would be fine...you'd expect back a 201 Created. To really do it, you'd want /emails instead of /email, and then you'd expect that you could a
by angersock 12y ago
A POST to /email would be fine...you'd expect back a 201 Created.
To really do it, you'd want /emails instead of /email, and then you'd expect that you could access any given email by /emails/<id>, getting a 401 or 403 if you tried to access one that doesn't exist. Further, you could expect that you could then augment the email resource with a status flag, and then you could even sort for sent emails by /emails?status=sent_and_acknowleged or similar.
For your second case, a POST would be a little weird, unless it returned you a new stats_report. I'd suggest changing that to /stats_reports, and have it create a new stats_report object. To view latest, you'd GET /stats_reports/head or something.