All jobs / Backend developer / API Development
Backend developer interview question · 0–1 years
The interviewer asks: “When do you use GET versus POST?” Strongest answer?
The strongest answer
GET for reads that must not change server state — it can be cached, logged and retried. POST when the call creates something or has a side effect.
Why it works
Exactly. The verb is a contract: GET is safe and idempotent; POST is allowed to create or change. Browsers, caches and CDNs rely on that.
What a good answer covers
- GET = no side effects; POST = create or change.
- Treat GET as cacheable and retry-safe.
- Use POST (or PUT/PATCH/DELETE) when the server will mutate.
- Never put secrets in a query string.
Answers that fall short
- Close, but not the strongest: GET to fetch data, POST to send data in the body.
Half right — POST can send a body, but GET with a body is not how you “send data.” The real split is side effects, not where the bytes sit. - Weak: POST for everything because hiding the parameters is more secure.
POST is not a security feature. Secrets in query strings still leak through logs, history and Referer. HTTPS plus the right verb. - Red flag: Put the password in a GET query string so I can bookmark the login URL.
Credentials in a URL are copied, cached and logged. That is a credential leak, not an API.
Who gets asked this
More API Development questions
- The interviewer asks: “What's the difference between HTTP 401 and 403?” Strongest answer?
- The interviewer asks: “When is 404 the right status, and when is 400?” Strongest answer?
- The interviewer sketches /getOrder and /doDeleteUser. Strongest design?
- The interviewer asks: “Which HTTP methods are safe to retry, and why?” Strongest answer?
- The interviewer asks: “How do you send and read JSON on an HTTP API?” Strongest answer?
- The interviewer asks: “What status do you return when POST creates a resource?” Strongest answer?
- The interviewer asks: “When do you nest URLs like /orders/12/items?” Strongest answer?
- In a GraphQL API, what is the schema and what is a resolver?