Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: API Gateway is a single entry point for APIs in a microservices architecture. Handles routing, load balancing, authentication, rate limiting, logging, monitoring. Examples: Kong, NGINX, AWS API Gateway, Azu…
Short answer: Configure CORS policy on the server. Allow specific origins, headers, and methods. 👉 Example in ASP.NET Core: services.AddCors(options => { options.AddPolicy("MyPolicy", builder => builder.…
Short answer: Rate limiting restricts the number of API requests per user/IP in a given time. Prevents abuse (DDoS, brute force). Ensures fair usage and protects backend systems. Return 429 Too Many Requests with Retry-A…
Short answer: Use an API Gateway for routing and orchestration. Implement service discovery (Consul, Eureka). Use message queues/event buses (RabbitMQ, Kafka) for async communication. Apply circuit breakers (Polly in .NE…
Short answer: Idempotent = multiple identical requests have the same effect as one request. Important for reliability and safe retries. HTTP Methods: GET, PUT, DELETE → Idempotent. POST → Not idempotent (creates new reso…
Short answer: 2xx Success → 200 (OK), 201 (Created). 4xx Client Errors → 400 (Bad Request), 401 (Unauthorized), 404 (Not Found). 5xx Server Errors → 500 (Internal Server Error), 503 (Service Unavailable). Error responses…
Short answer: Ensures correctness, reliability, performance, and security of APIs. Postman → Manual and automated API testing, environment variables, collections. Swagger (OpenAPI) → Live documentation, mock servers, aut…
Short answer: Horizontal scaling → Add more servers/containers. Load balancing across multiple instances. Database optimization (indexes, partitioning, read replicas). Caching at server, client, and CDN levels. Use async…
Short answer: Use a load balancer (NGINX, HAProxy, AWS ELB, Azure Front Door). Distribute traffic across multiple instances to avoid bottlenecks. Support round-robin, least connections, or IP hash strategies. Enable heal…
Short answer: Reduce payload size (use JSON instead of XML, compress responses). Implement pagination for large datasets. Apply caching at multiple levels. Use async I/O (non-blocking calls). Minimize database calls (bat…
Short answer: Caching is storing frequently used data temporarily to reduce server load and improve response time. Implementation methods: HTTP caching headers (Cache-Control, ETag, Expires). Reverse proxies (Varnish, NG…
Short answer: Client-side caching → Reduces server calls, but may serve stale data. Server-side caching → Faster responses, but increases memory usage. Proxy caching/CDN → Global scalability, but harder cache invalidatio…
Short answer: Content negotiation allows clients to specify desired response format. Uses HTTP headers: Accept: application/json → Request JSON. Accept: application/xml → Request XML. The server returns response in reque…
Short answer: REST API? Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure q…
Short answer: Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure query optim…
Short answer: Deploy servers closer to users (geo-distributed hosting). Use CDNs for static content. Apply connection pooling for databases. Reduce number of API calls (batching, GraphQL alternative). Use HTTP/2 or gRPC…
Short answer: PI performance? A CDN caches and delivers static or semi-static content from edge servers close to users. Reduces latency and improves response times. Helps with traffic offloading, reducing load on origin…
Short answer: A CDN caches and delivers static or semi-static content from edge servers close to users. Reduces latency and improves response times. Helps with traffic offloading, reducing load on origin servers. Support…
Short answer: Swagger/OpenAPI → Standard for REST API design and documentation. Postman → Can generate collections and documentation automatically. Redoc → Static documentation from OpenAPI specs. RAML → RESTful API Mode…
Short answer: Swagger/OpenAPI is a specification for defining REST APIs. Provides machine-readable and human-readable documentation. Enables automatic client SDK generation, testing, and validation. Improves team collabo…
Short answer: Contains all endpoints, request/response formats, parameters, headers, and security details. Acts as a contract between client and server. Used for auto-generating documentation, client SDKs, and mock serve…
Short answer: In ASP.NET Core: Use Swashbuckle package to generate Swagger UI from controllers and annotations. Explain a bit more services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = &…
Short answer: RAML (RESTful API Modeling Language) → YAML-based specification for APIs. Focuses on design-first API approach. Differences with OpenAPI/Swagger: RAML is more design-oriented; Swagger is implementation-orie…
Short answer: Postman is a GUI tool for testing REST APIs. Features: Send HTTP requests (GET, POST, PUT, DELETE). Automate tests using Postman Collections. Generate documentation and mock servers. Supports environment va…
Short answer: Use try-catch blocks in code to catch exceptions. Implement global exception handling middleware in ASP.NET Core: app.UseExceptionHandler(appError => { appError.Run(async context => { Example code con…
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: API Gateway is a single entry point for APIs in a microservices architecture. Handles routing, load balancing, authentication, rate limiting, logging, monitoring. Examples: Kong, NGINX, AWS API Gateway, Azure API Management. Use when: You have multiple microservices. Need centralized authentication/security. Need rate limiting or monitoring.
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: Configure CORS policy on the server. Allow specific origins, headers, and methods. 👉 Example in ASP.NET Core: services.AddCors(options => { options.AddPolicy("MyPolicy", builder => builder.WithOrigins(" .AllowAnyHeader() .AllowAnyMethod()); }); Apply with app.UseCors("MyPolicy");.
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: Rate limiting restricts the number of API requests per user/IP in a given time. Prevents abuse (DDoS, brute force). Ensures fair usage and protects backend systems. Return 429 Too Many Requests with Retry-After header. 👉 Example: 100 requests/minute per API key.
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 an API Gateway for routing and orchestration. Implement service discovery (Consul, Eureka). Use message queues/event buses (RabbitMQ, Kafka) for async communication. Apply circuit breakers (Polly in .NET) to handle failures. Implement distributed tracing (Jaeger, Zipkin, OpenTelemetry).
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: Idempotent = multiple identical requests have the same effect as one request. Important for reliability and safe retries. HTTP Methods: GET, PUT, DELETE → Idempotent. POST → Not idempotent (creates new resource each time).
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: 2xx Success → 200 (OK), 201 (Created). 4xx Client Errors → 400 (Bad Request), 401 (Unauthorized), 404 (Not Found). 5xx Server Errors → 500 (Internal Server Error), 503 (Service Unavailable). Error responses should include structured messages: { "status": 400, "error": "Invalid Data", "details": "Email 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: Ensures correctness, reliability, performance, and security of APIs. Postman → Manual and automated API testing, environment variables, collections. Swagger (OpenAPI) → Live documentation, mock servers, auto-generated client SDKs. Automates QA process and reduces bugs in production.
ASP.NET Web API ASP.NET Core Web API Tutorial · REST API
Short answer: Horizontal scaling → Add more servers/containers. Load balancing across multiple instances. Database optimization (indexes, partitioning, read replicas). Caching at server, client, and CDN levels. Use asynchronous processing for long-running tasks. Apply rate limiting and throttling to prevent abuse. Adopt microservices architecture for modular scaling.
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 a load balancer (NGINX, HAProxy, AWS ELB, Azure Front Door). Distribute traffic across multiple instances to avoid bottlenecks. Support round-robin, least connections, or IP hash strategies. Enable health checks to route traffic only to healthy instances. Combine with auto-scaling for dynamic traffic management.
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: Reduce payload size (use JSON instead of XML, compress responses). Implement pagination for large datasets. Apply caching at multiple levels. Use async I/O (non-blocking calls). Minimize database calls (batch queries, stored procedures). Enable GZIP compression on responses. Profile and monitor using APM tools (New Relic, Application Insights).
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: Caching is storing frequently used data temporarily to reduce server load and improve response time. Implementation methods: HTTP caching headers (Cache-Control, ETag, Expires). Reverse proxies (Varnish, NGINX). In-memory stores (Redis, Memcached). Client-side caching using 304 Not Modified.
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: Client-side caching → Reduces server calls, but may serve stale data. Server-side caching → Faster responses, but increases memory usage. Proxy caching/CDN → Global scalability, but harder cache invalidation. Database caching (Redis) → Faster queries, but adds complexity and consistency issues.
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: Content negotiation allows clients to specify desired response format. Uses HTTP headers: Accept: application/json → Request JSON. Accept: application/xml → Request XML. The server returns response in requested format (if supported). 👉 Example in ASP.NET Core: Add XML formatter with services.AddControllers() .AddXmlSerializerFormatters();
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: REST API? Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure query optimization with indexes. Implement validation to prevent SQL injection.
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: Add query parameters: Filtering: /products?category=shoes&brand=nike Sorting: /products?sort=price_asc Searching: /products?search=wireless+headphones Use LINQ/SQL queries in backend. Ensure query optimization with indexes. Implement validation to prevent SQL injection.
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: Deploy servers closer to users (geo-distributed hosting). Use CDNs for static content. Apply connection pooling for databases. Reduce number of API calls (batching, GraphQL alternative). Use HTTP/2 or gRPC for faster communication. Monitor latency with APM tools and optimize bottlenecks.
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 performance? A CDN caches and delivers static or semi-static content from edge servers close to users. Reduces latency and improves response times. Helps with traffic offloading, reducing load on origin servers. Supports DDoS protection and scaling under heavy loads. 👉 Cloudflare, Akamai, AWS CloudFront. Real-world example… (ShopNest) ShopNest… exposes REST APIs for cart and checkout. Controllers stay thin;…
business rules live in application services. PI performance? A CDN caches and delivers static or semi-static content from edge servers close to users. Reduces latency and improves response times. Helps with traffic offloading, reducing load on origin servers. Supports DDoS protection and scaling under heavy loads. 👉
Cloudflare, Akamai, AWS CloudFront. Real-world example… (ShopNest) 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: A CDN caches and delivers static or semi-static content from edge servers close to users. Reduces latency and improves response times. Helps with traffic offloading, reducing load on origin servers. Supports DDoS protection and scaling under heavy loads. 👉 Example: Cloudflare, Akamai, AWS CloudFront.
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: Swagger/OpenAPI → Standard for REST API design and documentation. Postman → Can generate collections and documentation automatically. Redoc → Static documentation from OpenAPI specs. RAML → RESTful API Modeling Language. Stoplight, Apiary, Docusaurus → Modern documentation and mocking platforms.
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: Swagger/OpenAPI is a specification for defining REST APIs. Provides machine-readable and human-readable documentation. Enables automatic client SDK generation, testing, and validation. Improves team collaboration and consistency in API design.
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: Contains all endpoints, request/response formats, parameters, headers, and security details. Acts as a contract between client and server. Used for auto-generating documentation, client SDKs, and mock servers.
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: In ASP.NET Core: Use Swashbuckle package to generate Swagger UI from controllers and annotations.
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" }); }); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API v1")); Other frameworks (Node.js: swagger-jsdoc, Spring Boot: springdoc-openapi) also support annotations and automatic documentation.
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: RAML (RESTful API Modeling Language) → YAML-based specification for APIs. Focuses on design-first API approach. Differences with OpenAPI/Swagger: RAML is more design-oriented; Swagger is implementation-oriented. OpenAPI has better tooling support and community adoption.
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: Postman is a GUI tool for testing REST APIs. Features: Send HTTP requests (GET, POST, PUT, DELETE). Automate tests using Postman Collections. Generate documentation and mock servers. Supports environment variables and CI/CD integration.
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 try-catch blocks in code to catch exceptions. Implement global exception handling middleware in ASP.NET Core: app.UseExceptionHandler(appError => { appError.Run(async context => {
context.Response.StatusCode = 500;
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(new { message = "Internal Server Error" }.ToString()); }); }); Log exceptions for debugging and monitoring.
Creating an order is POST /api/orders → 201 with Location header. Fetching is GET /api/orders/{id} → 200 or 404.