All fields

“RESTful Web APIs & Controllers” in Information Technology

95 questions across 3 technologies.

Information Technology

95 questions in 3 technologies

#QuestionTechnologyTopicLevel
1What is ControllerBase, and why do API controllers typically inherit from it rather than the full Controller class? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsBeginner
2How do you write integration tests that work consistently for both controller-based and minimal API endpoints using WebApplicationFactory? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
3How does Blazor handle routing, and what does the @page directive do? .NET › Blazor (Server & WebAssembly).NETBlazor (Server & WebAssembly)Intermediate
4Why is API versioning important for a production web API? .NET › API Versioning.NETAPI VersioningBeginner
5Why does an ASP.NET Core Web API need explicit versioning support, and what package provides it? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningBeginner
6What is gRPC, and what are its main advantages over traditional REST/JSON APIs? ASP.NET Core › gRPC ServicesASP.NET CoregRPC ServicesBeginner
7How do you configure ASP.NET Core to support multiple authentication schemes simultaneously, such as both cookies for a web UI and JWT for an API? ASP.NET Core › AuthenticationASP.NET CoreAuthenticationIntermediate
8How does minimal API content negotiation differ from the [ApiController]-based MVC approach, given minimal APIs return results via IResult? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
9How does UseRouting and endpoint routing (via MapControllers, MapGet, etc.) fit into the middleware pipeline conceptually? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineAdvanced
10How does ASP.NET Core support multiple authentication schemes simultaneously (e.g., cookies for a web UI and JWT for an API in the same application)? .NET › Authentication & Authorization (Identity, JWT, OAuth).NETAuthentication & Authorization (Identity, JWT, OAuth)Advanced
11How does CORS behave differently for requests made from a mobile app or server-to-server call compared to a browser-based web app? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingAdvanced
12How do you document and test webhook or callback endpoints (server-initiated calls to a client-registered URL) in OpenAPI 3.1? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIAdvanced
13How does dependency injection work identically for both Blazor components and MVC controllers, given they're both hosted in the same ASP.NET Core DI container? ASP.NET Core › Blazor Integration with ASP.NET CoreASP.NET CoreBlazor Integration with ASP.NET CoreAdvanced
14How does CORS behave for requests made from a mobile app, server-to-server call, or a tool like curl/Postman, compared to a browser-based web app? ASP.NET Core › CORS (Cross-Origin Resource Sharing)ASP.NET CoreCORS (Cross-Origin Resource Sharing)Advanced
15How would you design a route structure and constraint strategy for a large, RESTful API with deeply nested resource hierarchies (like organizations/{orgId}/projects/{projectId}/tasks/{taskId})? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesAdvanced
16What is the difference between authentication and authorization in ASP.NET Core? .NET › Authentication & Authorization (Identity, JWT, OAuth).NETAuthentication & Authorization (Identity, JWT, OAuth)Beginner
17What is CORS, and why do browsers enforce it? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingBeginner
18What does the WithMethods() CORS policy builder method control, and why restrict it instead of using AllowAnyMethod()? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingBeginner
19What is the purpose of global exception handling middleware in an ASP.NET Core application? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareBeginner
20What is OpenAPI, and how does Swashbuckle generate an OpenAPI document for an ASP.NET Core API? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIBeginner
21What does IsInRole() check, and how is it related to the [Authorize(Roles = "...")] attribute? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationBeginner
22What is content negotiation in ASP.NET Core, and how does the Accept header influence it? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersBeginner
23What is the purpose of global exception handling middleware in an ASP.NET Core application? ASP.NET Core › Error HandlingASP.NET CoreError HandlingBeginner
24What is the modern java.net.http.HttpClient (introduced in Java 11), and how does it improve on the older HttpURLConnection for making HTTP requests? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientBeginner
25How would you add custom HTTP headers (like an Authorization bearer token) to an outgoing request using HttpRequest.Builder? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientBeginner
26What are the main strategies for versioning an ASP.NET Core API (URL, query string, header, media type)? .NET › API Versioning.NETAPI VersioningIntermediate
27How do you implement URL-based API versioning using the Asp.Versioning.Mvc package in ASP.NET Core? .NET › API Versioning.NETAPI VersioningIntermediate
28How do you communicate API version deprecation to clients using response headers? .NET › API Versioning.NETAPI VersioningIntermediate
29How does semantic versioning (SemVer) inform decisions about when to bump an API's major, minor, or patch version? .NET › API Versioning.NETAPI VersioningIntermediate
30How do you version an API's OpenAPI/Swagger documentation to show separate docs per version? .NET › API Versioning.NETAPI VersioningIntermediate
31How does GraphQL's approach to API evolution differ from REST's typical versioning strategies? .NET › API Versioning.NETAPI VersioningIntermediate
32What HTTP status code and response should an API return when a client requests a version that no longer exists or was never supported? .NET › API Versioning.NETAPI VersioningIntermediate
33How can feature flags be used as an alternative or complement to formal API versioning for rolling out changes gradually? .NET › API Versioning.NETAPI VersioningIntermediate
34How do you implement role-based authorization using the [Authorize(Roles = "...")] attribute? .NET › Authentication & Authorization (Identity, JWT, OAuth).NETAuthentication & Authorization (Identity, JWT, OAuth)Intermediate
35What is the purpose of the 'scope' parameter in OAuth 2.0, and how does it implement the principle of least privilege? .NET › Authentication & Authorization (Identity, JWT, OAuth).NETAuthentication & Authorization (Identity, JWT, OAuth)Intermediate
36What is response caching middleware in ASP.NET Core, and how does it differ from application-level data caching? .NET › Caching (In-Memory, Distributed & Redis).NETCaching (In-Memory, Distributed & Redis)Intermediate
37What HTTP caching headers (Cache-Control, ETag) can a client and CDN use, and how do they relate to server-side caching strategies? .NET › Caching (In-Memory, Distributed & Redis).NETCaching (In-Memory, Distributed & Redis)Intermediate
38What does AllowCredentials() do in a CORS policy, and why can't it be combined with a wildcard origin? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingIntermediate
39What is the N+1 query problem in EF Core, and how does eager loading with Include() solve it? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessIntermediate
40How does the IExceptionHandler interface (introduced in .NET 8) provide a more structured alternative to the UseExceptionHandler lambda approach? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
41How do you map different exception types to different HTTP status codes in a global exception handler? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
42How do you handle exceptions specifically within minimal API endpoints, given they don't use the traditional MVC exception filter pipeline? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
43What is the difference between handling exceptions with middleware versus using try/catch blocks directly in controller actions? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
44How should a global exception handler differentiate between exceptions that should return specific client-facing details versus exceptions that should always show a generic message? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
45What is the role of the [ApiController] attribute in automatically handling certain error scenarios without explicit exception handling code? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareIntermediate
46How do you add global metadata (like a description, contact info, and license) to the top level of a generated OpenAPI document? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIIntermediate
47How does header-based API versioning work, and what's a scenario where it's preferred over URL segment versioning? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningIntermediate
48How does query string-based API versioning work, and what are its trade-offs compared to URL segment versioning? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningIntermediate
49How do you handle API versioning for gRPC services, given gRPC's contract is defined via .proto files rather than URL routes? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningIntermediate
50How do you define and apply policy-based authorization for requirements more complex than a simple role or claim check? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationIntermediate
51How do you add XML output formatting support to an ASP.NET Core API alongside the default JSON formatter? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
52How does ASP.NET Core decide which output format to use when a client's Accept header lists multiple acceptable types with quality values (q-values)? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
53How does System.Text.Json's configuration (via AddJsonOptions) let you customize the default JSON serialization behavior globally? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
54What is the [Produces] attribute, and how does it restrict which content types a specific action can return regardless of what the client's Accept header requests? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
55How do you test that an API correctly returns different formats based on the Accept header using integration tests? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
56How do you configure CORS to expose custom response headers (like X-Total-Count for pagination) to client-side JavaScript? ASP.NET Core › CORS (Cross-Origin Resource Sharing)ASP.NET CoreCORS (Cross-Origin Resource Sharing)Intermediate
57How does the WithMethods() CORS policy builder method restrict cross-origin requests, and why is it preferable to AllowAnyMethod() for sensitive endpoints? ASP.NET Core › CORS (Cross-Origin Resource Sharing)ASP.NET CoreCORS (Cross-Origin Resource Sharing)Intermediate
58How do you define optional route parameters, and what's the difference between an optional parameter and one with a default value? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesIntermediate
59How do route parameter transformers let you customize the casing convention of generated URLs, such as converting PascalCase action names to kebab-case URLs? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesIntermediate
60How do you map different custom exception types to different HTTP status codes in a global exception handler? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
61How should a global exception handler differentiate between exceptions meant for client-facing details versus exceptions that should always show a generic message? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
62How do you apply a filter globally to every controller action, versus scoping it to a specific controller or individual action? ASP.NET Core › FiltersASP.NET CoreFiltersIntermediate
63What is the difference between a filter attribute applied directly (like [MyFilter]) and using [TypeFilter]/[ServiceFilter] to apply the same filter class? ASP.NET Core › FiltersASP.NET CoreFiltersIntermediate
64What are JSON transcoding for gRPC services in ASP.NET Core, and why would you enable it? ASP.NET Core › gRPC ServicesASP.NET CoregRPC ServicesIntermediate
65What is the valueOf() method on an enum, and what happens when you pass a name that doesn't match any declared constant? Java › EnumsJavaEnumsIntermediate
66How would you send a POST request with a JSON request body using HttpClient, and correctly parse a JSON response using a library like Jackson? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientIntermediate
67How would you send URL-encoded form data (application/x-www-form-urlencoded) using HttpClient, as opposed to a JSON request body? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientIntermediate
68How can you version a single controller action to support multiple API versions without duplicating the entire controller class? .NET › API Versioning.NETAPI VersioningAdvanced
69What's the difference between versioning a REST API's contract versus versioning its underlying data model, and why does that distinction matter? .NET › API Versioning.NETAPI VersioningAdvanced
70What is the 'tolerant reader' pattern, and how does it reduce the need for frequent API versioning? .NET › API Versioning.NETAPI VersioningAdvanced
71What are the trade-offs of versioning an entire API at once (global versioning) versus versioning individual endpoints independently? .NET › API Versioning.NETAPI VersioningAdvanced
72How do minimal API endpoint filters (IEndpointFilter) compare to traditional middleware for cross-cutting logic? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineAdvanced
73How do you implement policy-based authorization for more complex, custom access rules beyond simple roles? .NET › Authentication & Authorization (Identity, JWT, OAuth).NETAuthentication & Authorization (Identity, JWT, OAuth)Advanced
74What is a CORS preflight request, and when does the browser send one automatically? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingAdvanced
75How do you configure CORS to expose custom response headers to client-side JavaScript using Access-Control-Expose-Headers? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingAdvanced
76What are keyed services (introduced in .NET 8), and what problem do they solve compared to multiple unnamed registrations? .NET › Dependency Injection.NETDependency InjectionAdvanced
77How do you implement soft deletes in EF Core using a global query filter? .NET › Entity Framework Core & Data Access.NETEntity Framework Core & Data AccessAdvanced
78What is ProblemDetails (RFC 7807/9457), and how does ASP.NET Core support it for standardized error responses? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
79How does exception handling middleware interact with model validation errors in ASP.NET Core, and how do they typically produce different error response paths? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
80How would you design exception handling middleware to support internationalized (localized) error messages returned to clients in different languages? .NET › Global Exception Handling & Middleware.NETGlobal Exception Handling & MiddlewareAdvanced
81How would you generate a client SDK automatically from an ASP.NET Core API's OpenAPI specification? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIAdvanced
82What is 'design-first' versus 'code-first' API development, and how does OpenAPI tooling support each approach? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIAdvanced
83How does schema reuse work in OpenAPI (via $ref and components/schemas), and how does Swashbuckle handle types shared across multiple endpoints? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIAdvanced
84How do you deprecate an API version gracefully, notifying consumers via response headers before eventually removing it? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningAdvanced
85How does ASP.NET Core API versioning handle a request that doesn't specify any version at all? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningAdvanced
86How would you design API versioning strategy differently for a public, third-party-consumed API versus an internal microservice API? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningAdvanced
87How do you combine multiple version reader strategies (e.g., both URL segment AND header) to give clients flexibility in how they specify a version? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningAdvanced
88How does the AuthorizationMiddlewareResultHandler let you customize the response returned when authorization fails, beyond the default 401/403? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationAdvanced
89Why is RespectBrowserAcceptHeader disabled by default in ASP.NET Core, and what problem does this default avoid? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersAdvanced
90What is a CORS preflight request, and when does the browser automatically send one before the actual request? ASP.NET Core › CORS (Cross-Origin Resource Sharing)ASP.NET CoreCORS (Cross-Origin Resource Sharing)Advanced
91How do you generate a URL for a named route or endpoint programmatically, rather than hardcoding URL strings throughout the application (like in a Location header for a 201 Created response)? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesAdvanced
92What is ProblemDetails (RFC 7807/9457), and how does ASP.NET Core support it for standardized error responses across an API? ASP.NET Core › Error HandlingASP.NET CoreError HandlingAdvanced
93How does exception handling middleware interact with model validation errors, and why do they typically produce two entirely separate error response paths? ASP.NET Core › Error HandlingASP.NET CoreError HandlingAdvanced
94How would you implement a filter that modifies the action's result based on the outcome, such as wrapping every successful response in a standard envelope? ASP.NET Core › FiltersASP.NET CoreFiltersAdvanced
95How would you correctly serialize and deserialize java.time types (like LocalDateTime or ZonedDateTime) to/from JSON using a library like Jackson, and what common configuration pitfalls arise? Java › Java Date & Time API (java.time)JavaJava Date & Time API (java.time)Advanced