.NET

Web API Development

REST principles, HTTP verbs, status codes, content negotiation, versioning, API design

22 interview questionsยท
Mid-Level
1

Which REST principle requires that an API stores no session state between requests?

Answer

The statelessness principle requires that each request contains all necessary information to be processed. The server maintains no session context between calls. This improves scalability as requests can be handled by any server without state sharing.

2

Which HTTP verb should be used to create a new resource in a REST API?

Answer

POST is the standard HTTP verb for creating new resources. It is not idempotent: each call creates a new instance. The server typically determines the URI of the created resource and returns it via the Location header with a 201 Created status.

3

Which HTTP status code should be returned after a successful resource creation with POST?

Answer

The 201 Created status code indicates that a new resource has been successfully created. It should be accompanied by a Location header containing the URI of the created resource. This allows the client to immediately retrieve the resource via GET, unlike 200 OK which doesn't provide this semantic.

4

What is the main difference between PUT and PATCH in a REST API?

5

Which HTTP status code should be returned when a requested resource does not exist?

+19 interview questions

Master .NET for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free