Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Yes. If the resource does not exist, PUT can create it at the specified URI. Example: 👉 PUT /users/100 → If user 100 doesn’t exist, it will be created. Real-world example (ShopNest) Creating an order is PO…
Short answer: PATCH → Updates only the specified fields (partial update). PUT → Replaces the entire resource representation. 👉 Example code PATCH /users/1 { "email": "new@email.com" } → Updates only…
Short answer: PI? The GET method is used to fetch data because it is safe, idempotent, and optimized for retrieval operations. Real-world example (ShopNest) Creating an order is POST /api/orders → 201 with Location heade…
Short answer: The GET method is used to fetch data because it is safe, idempotent, and optimized for retrieval operations. Real-world example (ShopNest) Creating an order is POST /api/orders → 201 with Location header. F…
Short answer: PIs? HTTP status codes are 3-digit numbers returned by the server to indicate the result of a client request. They are important because they: Communicate success, failure, or redirection. Help clients hand…
Short answer: HTTP status codes are 3-digit numbers returned by the server to indicate the result of a client request. They are important because they: Communicate success, failure, or redirection. Help clients handle re…
Short answer: It indicates that a new resource was successfully created. Usually returned after a POST request, along with a Location header pointing to the new resource. Real-world example (ShopNest) Creating an order i…
Short answer: Returned when the request is malformed or invalid, such as: Missing required parameters. Invalid JSON format. Wrong data type provided. Real-world example (ShopNest) ShopNest exposes REST APIs for cart and…
Short answer: It means the client is not authenticated (missing/invalid credentials). The request cannot proceed without proper authentication (e.g., missing token). Say this in the interview Define — one clear sentence…
Short answer: It means the client is authenticated but not authorized to access the resource. 👉 Example: A normal user trying to access an admin-only endpoint. Real-world example (ShopNest) Creating an order is POST /ap…
Short answer: It means the resource has not changed since the last request. Commonly used with caching to improve performance (client uses cached version). Real-world example (ShopNest) Creating an order is POST /api/ord…
Short answer: 503 indicates the server is temporarily unavailable (e.g., maintenance, overload). Best practices: Return a Retry-After header. Use monitoring/alerts to restore service quickly. Say this in the interview De…
Short answer: A redirect tells the client to fetch a resource from a different URL. 301 Moved Permanently → Resource moved permanently (update bookmarks/links). 302 Found → Temporary redirect (use current URL for future…
Short answer: In REST, resources (like users, products, orders) are identified with URLs instead of actions. 👉 Example in ASP.NET Core Web API: // Instead of action-based GET /getUser?id=1 // Use resource-based GET /use…
Short answer: Statelessness → No server memory required for client sessions → Easy to scale horizontally. Layered System → Load balancers, caching layers can be added without changing API. Uniform Interface → Predictable…
Short answer: (With C# ASP.NET Core Web API example) Discoverability means clients can navigate and learn available actions through metadata or hypermedia links, without hardcoding routes. 👉 Example using HATEOAS in ASP…
Short answer: Discoverability means clients can navigate and learn available actions through metadata or hypermedia links, without hardcoding routes. Explain a bit more 👉 Example using HATEOAS in ASP.NET Core Web API: […
Short answer: Use resource-based URLs (/users/1/orders) not action-based (/getUserOrders). ● Return proper status codes (200, 201, 400, 404, 500). Support pagination & filtering for large data. Implement authenticati…
Short answer: Use nouns, not verbs → GET /users (not /getUsers). Use plural form → /users, /orders. Nested resources for relationships → /users/1/orders. Consistent naming conventions. Avoid exposing internal DB structur…
Short answer: Consistency in naming and responses. Error handling with meaningful messages. Security (HTTPS, JWT, OAuth2). Scalability (statelessness, caching). Performance (pagination, filtering). Documentation (Swagger…
Short answer: Return proper status codes and a structured error object: 👉 Example in ASP.NET Core: { "status": 400, "error": "Invalid Request", "details": "Email field is req…
Short answer: Prevents large payloads. Improves performance and response times. Reduces server and network load. 👉 Example code GET /users?page=2&limit=20. Real-world example (ShopNest) Creating an order is POST /ap…
Short answer: Authentication → API Keys, JWT, OAuth2. Authorization → Role-based access control. Always use HTTPS. Validate input & sanitize data. Prevent SQL injection, XSS, CSRF. Real-world example (ShopNest) Creat…
Short answer: Provide versioning. Send Deprecation warning headers. Maintain old versions temporarily. Give developers migration guides. Real-world example (ShopNest) ShopNest exposes REST APIs for cart and checkout. Con…
Short answer: uthentication? Pros: Secure delegated access. Widely adopted (Google, Facebook, GitHub). Works well for 3rd-party apps. Cons: Complex implementation. Requires token management. Overhead for small/simple API…
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Yes. If the resource does not exist, PUT can create it at the specified URI. Example: 👉 PUT /users/100 → If user 100 doesn’t exist, it will be created.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: PATCH → Updates only the specified fields (partial update). PUT → Replaces the entire resource representation. 👉
PATCH /users/1 { "email": "new@email.com" } → Updates only the email. PUT /users/1 { "name": "John" } → May overwrite other fields like email if not included.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: PI? The GET method is used to fetch data because it is safe, idempotent, and optimized for retrieval operations.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: The GET method is used to fetch data because it is safe, idempotent, and optimized for retrieval operations.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: PIs? HTTP status codes are 3-digit numbers returned by the server to indicate the result of a client request. They are important because they: Communicate success, failure, or redirection. Help clients handle responses consistently. Provide debugging and monitoring information.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: HTTP status codes are 3-digit numbers returned by the server to indicate the result of a client request. They are important because they: Communicate success, failure, or redirection. Help clients handle responses consistently. Provide debugging and monitoring information.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: It indicates that a new resource was successfully created. Usually returned after a POST request, along with a Location header pointing to the new resource.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Returned when the request is malformed or invalid, such as: Missing required parameters. Invalid JSON format. Wrong data type provided.
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: It means the client is not authenticated (missing/invalid credentials). The request cannot proceed without proper authentication (e.g., missing token).
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: It means the client is authenticated but not authorized to access the resource. 👉 Example: A normal user trying to access an admin-only endpoint.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: It means the resource has not changed since the last request. Commonly used with caching to improve performance (client uses cached version).
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: 503 indicates the server is temporarily unavailable (e.g., maintenance, overload). Best practices: Return a Retry-After header. Use monitoring/alerts to restore service quickly.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: A redirect tells the client to fetch a resource from a different URL. 301 Moved Permanently → Resource moved permanently (update bookmarks/links). 302 Found → Temporary redirect (use current URL for future requests).
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: In REST, resources (like users, products, orders) are identified with URLs instead of actions. 👉 Example in ASP.NET Core Web API: // Instead of action-based GET /getUser?id=1 // Use resource-based GET /users/1 This makes APIs cleaner and more intuitive.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Statelessness → No server memory required for client sessions → Easy to scale horizontally. Layered System → Load balancers, caching layers can be added without changing API. Uniform Interface → Predictable, decouples client and server. Cacheability → Reduces server load.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: (With C# ASP.NET Core Web API example) Discoverability means clients can navigate and learn available actions through metadata or hypermedia links, without hardcoding routes. 👉 Example using HATEOAS in ASP.NET Core Web API: [HttpGet("users/{id}")] public IActionResult GetUser(int id)
{
var user = new { Id = id, Name = "Alice" };
var response = new
{ user, links = new[] { new { rel = "self", href = Url.Action("GetUser", new { id }) }, new { rel = "orders", href = Url.Action("GetUserOrders", new { id }) } } }; return Ok(response);
} The API response itself guides the client to related resources (user’s orders, profile, etc.). Q&A
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Discoverability means clients can navigate and learn available actions through metadata or hypermedia links, without hardcoding routes.
👉 Example using HATEOAS in ASP.NET Core Web API: [HttpGet("users/{id}")] public IActionResult GetUser(int id) { var user = new { Id = id, Name = "Alice" }; var response = new { user, links = new[] { new { rel = "self", href = Url.Action("GetUser", new { id }) }, new { rel = "orders", href = Url.Action("GetUserOrders", new { id }) } } }; return Ok(response); } The API response itself guides the client to related resources (user’s orders, profile, etc.). var response = new { user, links = new[] { new { rel = "self", href = Url.Action("GetUser", new { id }) }, new { rel = "orders", href = Url.Action("GetUserOrders", new { id }) } } }; return Ok(response); } The API response itself guides the client to related resources (user’s orders, profile, etc.). Q&A
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Use resource-based URLs (/users/1/orders) not action-based (/getUserOrders). ● Return proper status codes (200, 201, 400, 404, 500). Support pagination & filtering for large data. Implement authentication & authorization (JWT, OAuth2). Ensure statelessness. Provide versioning (v1, v2). Secure API with HTTPS only.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Use nouns, not verbs → GET /users (not /getUsers). Use plural form → /users, /orders. Nested resources for relationships → /users/1/orders. Consistent naming conventions. Avoid exposing internal DB structure.
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Consistency in naming and responses. Error handling with meaningful messages. Security (HTTPS, JWT, OAuth2). Scalability (statelessness, caching). Performance (pagination, filtering). Documentation (Swagger/OpenAPI).
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Return proper status codes and a structured error object: 👉 Example in ASP.NET Core: { "status": 400, "error": "Invalid Request", "details": "Email field is required" }
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Prevents large payloads. Improves performance and response times. Reduces server and network load. 👉
GET /users?page=2&limit=20.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Authentication → API Keys, JWT, OAuth2. Authorization → Role-based access control. Always use HTTPS. Validate input & sanitize data. Prevent SQL injection, XSS, CSRF.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Provide versioning. Send Deprecation warning headers. Maintain old versions temporarily. Give developers migration guides.
ShopNest exposes REST APIs for cart and checkout. Controllers stay thin; business rules live in application services.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: uthentication? Pros: Secure delegated access. Widely adopted (Google, Facebook, GitHub). Works well for 3rd-party apps. Cons: Complex implementation. Requires token management. Overhead for small/simple APIs.
ShopNest mobile app sends a JWT Bearer token. The API validates it and uses the user id from claims to load that user’s cart only.