System design interview question
Design an Email Service API service
Requirements
Who is the end consumer of the API ?
- Internal developers
- Third party developers
Security
- Authentication
- Authorization
- Auditing
Database
- Max storage per company based on the plans
- Max storage per user based on the plans
Server Geo Locations
- North America : US East, US West
- Asia pacific: India, China
- Europe : London, Frankfaurt
- South America
Error codes
HTTP Status ---> Message
Bad Request (400) ---> One of the HTTP headers or query param in the request is not present or incorrect.
Forbidden (403) ---> Authorization error. Please enter valid credentials.
Not Found (404) ---> The resource does not found.
Internal error (500) ---> Server is not responsive. Please try again later.
API Design with semantic meaning
action ---> verb - URI
create ---> POST - {uri}/api/v1/emails
update ---> PUT - {uri}/api/v1/emails/{email_id}
retrive --> GET - {uri}/api/v1/emails/{email_id}
delete ---> DELETE - {uri}/api/v1/emails/{email_id}
search ---> GET - {uri}/api/v1/emails?user_id={...}&order_by={...}&search_by={...}&per_page={...}