TechnicalEasy HTTP & REST APIs

What is a REST API and what makes an API RESTful?

Asked for Backend Developer, Full-Stack Developer

Why they ask this: Most backend roles in Nepal build JSON APIs for web and mobile clients.

Answer

REST (Representational State Transfer) is an architectural style for APIs built on HTTP. Key ideas:

  • Resources are identified by URLs using nouns: /jobs, /jobs/42, /companies/7/jobs.
  • HTTP methods express the action: GET /jobs lists, POST /jobs creates, PATCH /jobs/42 updates, DELETE /jobs/42 deletes.
  • Stateless: each request carries everything needed (such as the auth token). The server keeps no client session between requests.
  • Representations: usually JSON, with the right Content-Type.
  • Correct status codes and a consistent error format.
  • Cacheable responses where appropriate.

Good practice: version the API (/api/v1), paginate lists, use plural nouns and avoid verbs in URLs (POST /jobs/42/applications, not /applyJob).

Can you explain this in your own words?

Back to question bank