📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Phase 13 — Web APIs and HTTP

Designing and running HTTP APIs well: HTTP semantics, REST principles, API design (versioning, pagination, errors and contracts) and reliability features such as rate limiting, idempotency keys, caching and gateways, in ASP.NET Core 10.

  1. What is a brownout, and how would you run one before removing an API version?
    Mid-Level Coding API Design
  2. When would you put a search behind POST /orders/search instead of GET with query parameters?
    Intermediate Coding API Design
  3. How do you introduce a stricter validation rule on a live API without breaking existing clients?
    Senior Theory API Design
  4. Would you introduce a backend for frontend (BFF) for the mobile app to avoid this class of problem?
    Senior RealWorldScenario API Design
  5. A team refuses to adopt the shared error format because their existing clients depend on their own. How do you handle it?
    Staff / Architect Architecture API Design
  6. What are the main API versioning strategies: URL segment, query string, header and media type? Compare them, explain how the Asp.Versioning library supports each in ASP.NET Core, and tell me when you would avoid introducing a new version at all.

    Compares URL, query string, header and media type API versioning, how Asp.Versioning implements them on .NET 10, and when evolving without a new version is the better choice.

    Intermediate Theory API Design Β· πŸ”— 3 follow-ups
  7. Show me how you version an ASP.NET Core 10 API with Asp.Versioning, generate a separate OpenAPI document for each version with the built-in OpenAPI support, and tell clients a version is deprecated using the Deprecation and Sunset headers. How do you keep v1 and v2 sharing the same business logic?

    Implements Asp.Versioning 10.x with Minimal APIs, one OpenAPI document per version, Deprecation (RFC 9745) and Sunset (RFC 8594) headers, and edge-only DTO mapping so versions share one domain.

    Mid-Level Coding API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. How do you design pagination for a REST API? Compare offset and cursor (keyset) pagination, describe the response shape you would return (items, next link or cursor, page size limits), explain what returning a total count really costs, and how you keep pages stable while data changes.

    API contract for pagination: offset vs cursor, opaque cursors, next links, page size limits, the cost of total counts on SQL Server, and stability under concurrent inserts and deletes.

    Mid-Level Coding API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. Show me how you would implement filtering, sorting and searching on a collection endpoint in ASP.NET Core without opening yourself to injection or runaway queries. How do you allow-list sort fields, map them to EF Core safely, handle free-text search, and when would you consider OData instead?

    Safe filtering, sorting and searching for list endpoints: typed filter parameters, allow-listed sort fields mapped to expressions, parameterised search, query cost limits, and OData trade-offs.

    Intermediate Coding API Design Β· πŸ”— 3 follow-ups
  10. How should an API design its error responses? Explain ProblemDetails (RFC 9457) and its fields, how you represent validation errors, why you would define a catalogue of stable error codes, how you avoid leaking internals, and how you keep errors consistent across many services.

    Error response design: RFC 9457 ProblemDetails fields and extensions, validation error shape, a stable error-code catalogue, hiding internals with a trace id, and consistency across services and gateways.

    Intermediate Theory API Design Β· πŸ”— 3 follow-ups
  11. Contract-first or code-first: how do you design an HTTP API? Explain writing the OpenAPI document first versus generating it from code, how you run API design reviews, how generators and mock servers fit in, and which approach you would choose for a new partner-facing API on .NET 10.

    Contract-first (design-first) versus code-first API development: the OpenAPI document as the source of truth, design reviews, server and client generation, mock servers, drift detection, and choosing per context.

    Mid-Level Theory API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  12. What counts as a breaking change in an HTTP API? Go beyond removed fields: discuss new enum values, stricter validation, changed defaults, new required fields and behaviour changes. Explain the tolerant reader pattern, how System.Text.Json settings affect it, and how consumer-driven contract tests protect backward compatibility.

    Classifies API changes as breaking or safe (including enums, validation, defaults and semantics), the tolerant reader pattern and System.Text.Json settings that support it, and consumer-driven contract testing with Pact.

    Senior Theory API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  13. Tell me about a time an API release broke a mobile app that users hadn't updated. Walk through how you detected it, how you rolled back or mitigated, and the versioning, compatibility and deprecation policy you put in place so older app versions keep working.

    A real-world incident where an API change broke old mobile app versions: detection, rollback and mitigation, root cause, and the resulting policy for app-version telemetry, compatibility windows, minimum-version enforcement and deprecation.

    Senior RealWorldScenario API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  14. Beyond an OpenAPI document, what makes API documentation good? Talk about examples, documenting errors and edge cases, getting-started guides, changelogs, and when a developer portal such as Azure API Management's is worth it. How do you keep documentation accurate as the API changes?

    API documentation beyond the generated spec: task-based guides, realistic examples, error and rate-limit documentation, changelogs and deprecation notices, developer portals (APIM), and keeping docs accurate through automation.

    Mid-Level Theory API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  15. Code review: a customer API returns its EF Core entities directly. The response includes internal database ids and a PasswordHash, property names mix PascalCase and snake_case, dates are DateTime with no offset, money is a double, and the list endpoint has no page-size limit. What problems do you find, ranked by severity, and how would you redesign the DTOs?

    Code review of API response contracts: data exposure from returning entities, over-posting, unbounded lists, money as double, dates without offsets, inconsistent naming and internal ids, with a DTO-based rewrite.

    Senior CodeReview API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  16. You're asked to set API governance for 20 teams who each publish HTTP APIs. How would you design it: a style guide, automated linting with something like Spectral, the review process, shared standards for errors, pagination and versioning, and how do you keep it from becoming a bottleneck that teams route around?

    Organisation-wide API governance: a style guide, automated OpenAPI linting with Spectral in CI, lightweight risk-based reviews, shared building blocks for errors, paging and versioning, an API catalogue, and measuring adoption without becoming a bottleneck.

    Staff / Architect Architecture API Design Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  17. How would you enforce a single rate limit across 10 instances of an ASP.NET Core API?
    Intermediate Theory API Reliability
  18. When would you choose a 409 Conflict over a 412 Precondition Failed?
    Mid-Level Theory API Reliability
  19. How do you invalidate cached API responses across several instances and a CDN when the data changes?
    Intermediate Theory API Reliability
  20. What is the difference between rate limiting and throttling for an HTTP API? Explain the fixed window, sliding window, token bucket and concurrency limiter algorithms, what each one allows and prevents, and how a well-behaved API tells a client it has hit a limit (429 Too Many Requests, Retry-After).

    Rate limiting vs throttling, the four common limiter algorithms (fixed window, sliding window, token bucket, concurrency), their burst behaviour, and signalling limits with 429 and Retry-After.

    Intermediate Theory API Reliability Β· πŸ”— 2 follow-ups

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me