Basics, methods and statuses
An answer in two sentences is exactly what an interviewer expects for a basic question. Then the conversation will go deeper by itself.
| Question | Short answer |
|---|---|
| How does client-server architecture work? | The client sends an HTTP request, the server checks authorisation, runs the logic, works with the database and returns a response with a status. HTTP is stateless, so the token goes in every request. |
| What is REST? | An API style where data are resources at URLs, and actions are set by HTTP methods. Stateless, usually JSON. |
| PUT vs PATCH? | PUT replaces a resource entirely and is idempotent. PATCH changes individual fields. |
| What is idempotency? | A repeated identical request doesn't change the state beyond the first. GET, PUT, DELETE: yes; POST: no, so payments have an Idempotency-Key. |
| 401 vs 403? | 401: not authenticated. 403: authenticated, but without rights. |
| 400 vs 422? | 400: the request is incorrect in form. 422: the form is fine, but a business rule is violated. |
| The server returned 500 for invalid data. Is that a bug? | Yes. Invalid input must give a 4xx with an explanation; 500 means an unhandled exception. |
In an interview: Short answers are the basics, but after them it is worth giving an example from a project, for example how I caught a 500 on invalid input or checked an
Idempotency-Key. An example shows experience better than a definition.