
Explore building and securing ASP.NET Core Web API apps in .NET 10, from routing and CRUD to EF Core, MVC consumption, JSON Web Token authentication, and OpenAPI tooling.
Define a web api as remotely hosted functions accessible over the internet via the HTTP protocol to share data and functionality across devices.
Learn how a web api works in theory by routing http requests to endpoints and exposing create, read, update, and delete operations via http verbs on a server-based application.
Demonstrates how a .NET minimal API uses routing and http verbs to expose endpoints like /shirts for get, post, put, and delete, running as a console app.
Explore how a web API framework manages routing, authentication, model binding, validation, exception handling, and result formatting so developers focus on business logic and data operations.
Explore how ASP.NET Core uses a middleware pipeline to process HTTP requests through sequential middleware components, forming a chain of responsibilities from routing to authentication and authorization.
Compare minimal APIs and MVC style controllers to build web APIs in .NET, and organize endpoints with shirts and pants controllers by deriving from ControllerBase and decorating with ApiController.
Learn to map http requests to action methods in controller-based web APIs using map controllers and attribute routing, and apply a route template for consistent api/shirts endpoints.
Map data from http requests to the parameters of an action method using model binding in asp.net core web api, sourcing data from route, query, header, and body.
Learn how ASP.NET Core Web API validates models between binding and action execution using data annotations. Apply attributes like required, range, url, and compare to auto-generate clear JSON error messages.
Create custom validation attributes beyond data annotations to validate multiple properties, enforcing size rules—men: size >= 8 and women: size >= 6—via the validation context in a .NET Web API.
Explore how to choose return types for web api endpoints in .NET, switching from string to in-memory data, and using IActionResult to handle 200, 404, and 400 responses.
Create an in-memory repository under the models folder as a static shirt repository to host data. Implement exists and get shirt by id, handle nulls, and test with postman.
Use an action filter to validate the shirt id before the action executes, returning 400 or 404 with problem details to separate validation from action logic.
Implement a read endpoint for shirts using an in-memory data store, a shirt repository, and a get shirts method; verify retrieval with Postman.
Implement a create shirt endpoint using an in-memory repo, generate a new id, validate input and duplicates, and return 201 created with a location header to get shirt by id.
Validate a create shirt endpoint with an action filter in .NET 10, extracting validations from the controller to a reusable filter, short-circuiting on errors and returning 400.
Implement the update shared endpoint in the in-memory web API by validating IDs, updating the shirt in the shared repository, and returning 204 on success or 404/400 for errors.
Move exception handling in Web API endpoints from try-catch to an exception filter, validating IDs and returning 404 not found when the shirt does not exist.
Implement a delete endpoint by validating the shirt ID, performing a hard delete from the in-memory store, and testing with postman to confirm the updated list.
Learn how EF Core maps objects to a SQL Server database via an orm, and install NuGet packages for EF Core SQL Server, Tools, and Design to manage migrations.
Install and verify three EF Core NuGet packages—Entity Framework Core.SqlServer, Entity Framework Core.Tools, and Entity Framework Core.Design—within a .NET project, then confirm they appear in the project file.
Learn code-first development with Entity Framework Core by building an in-memory database using a data context and shirts table, then configure the model creating method and seed data for migrations.
Create the database and shirts table by applying the initial migration to SQL Server, and configure the connection string in app settings for the shirts store management database.
Implement the get shirts endpoint using entity framework core and the application db context, replacing the in-memory shirt repository with a db set and constructor injection, and verify with postman.
Implement a get by id endpoint with EF Core and SQL Server, using an action filter and constructor injection to validate shirt existence via the shared repository.
Implement a post endpoint with entity framework core, replacing the in-memory repository, inject the application db context, use lower-case comparison, and persist new shirts via change tracker and save changes.
Learn how to implement a put endpoint with EF Core by replacing the static repository, validating IDs with action filters, using FirstOrDefault, tracking changes, saving updates, and returning no content.
Implement a delete endpoint using EF Core by replacing the static repository, retrieving the shirt to delete, marking it as deleted, saving changes, and returning the deleted shirt.
Add an ASP.NET Core MVC project to the solution and set it as the startup project to consume existing web api endpoints. The default template includes homepage and privacy page.
Add a shirts page to display a list of shirts using an mvc shirts controller and a razor view, using an in-memory repository and bootstrap table; no api calls yet.
Build a web api executor with IHttpClientFactory, configure a named http client with headers, implement a generic get method, and inject it into the MVC controller to fetch data.
Use the web api executor to fetch shirts from the api, display them on the mvc shirts page, and verify the read-all shirts endpoint with postman.
Create shirt form in Razor view, connect it from shirts index to the create shirt action with Bootstrap, and implement a post method for brand, color, size, and price.
Implement MVC form validation in .NET 10 by showing model-based errors with a validation summary and tag helpers, and display field-level messages for brand, gender, color, size, and price.
Post a new shirt via the web api to the shirts endpoint, validate the model state, and redirect to the shirts index after successful creation in the database.
Update shirt view teaches fetching a shirt by id through a get action, binding it to a razor view, and posting updates from a form in the update shirt page.
Shows updating a shirt through a web api by posting from an mvc action, using http put with id in the URL and shirt data in the body, with validation.
Learn to delete a shirt using a post-based web api call from a form, with a hidden shirt id and a confirmation prompt, then verify via end-to-end testing.
Learn robust error handling in the mvc web api executor by deserializing api error responses, throwing a custom web api exception, and handling post, put, and delete errors.
Display API error messages by catching web API exceptions in the shirts create action, collecting non-null errors, joining them, and showing all errors in the create shirt view’s validation summary.
Implement a helper method to handle web API exceptions, add the error to the model state, and display it on the update shirt view.
Handle web api exceptions in an mvc app by displaying error messages for delete shirt. Return the index view to preserve modal state and show a red validation summary.
Explore how authentication, token-based authorization, and token verification secure web api endpoints, with an application, authority, and resource exchanging a client id, secret, and token.
Register apps against the authority to enable authentication in a web api, using a hardcoded in-memory store to simulate registered apps with client id and secret.
Authenticate apps against authority by posting app credentials to an authority endpoint, validating via the app repository, and returning an access token with a 10-minute expiry.
Compare custom tokens and json web tokens (jwt) in a token authentication workflow, highlighting in-memory verification with a signing key, hashing algorithm, claims, and expiration without database lookups.
Generate a json web token by configuring hmac sha256 signing, building a token descriptor with claims and scopes, and testing token creation with postman.
refactor authentication logic by extracting authenticate and create token into a static authenticator class, update authority controller calls, and validate with postman to ensure functionality remains unchanged.
Verify a json web token (jwt) by sending it in the authorization header with a bearer prefix to access a .NET web api.
Learn to consume secured web API endpoints by authenticating against the authority, obtaining a JWT access token, and attaching it to the HTTP header for each request.
Learn to save a jwt token in session backed by a cookie and reuse it to avoid authenticating the token on every request, using http context accessor to access session.
Learn how to handle expired tokens by checking token expiry time, reauthenticating to regenerate and store a new token in session, and reusing tokens for subsequent requests.
Implement manual authorization based on application claims with a required claim attribute on endpoints for read, write, and delete permissions, and validate token claims via a custom jwt filter.
Document and visualize your .NET web API with OpenAPI and Swagger UI, enable OpenAPI support, install the necessary package, and test endpoints and responses.
Configure the OpenAPI document to apply a security requirement with a bearer token, using a document transformer in dotnet 10, and enable the authorize button in swagger UI.
Install two NuGet packages to support versioning for controller style web api endpoints: ASP versioning MVC and ASP versioning MVC API explorer.
Explore adding a second API version by creating a v2 controller, configuring API versioning and explorer, and addressing OpenAPI/swagger limitations in .NET 10.
add swagger document support to a web api by installing swashbuckle and open api packages, configuring middleware, and enabling swagger ui in development to document and explore endpoints.
Implement an authorization header in Swagger by configuring a security scheme and an operation filter, enabling bearer token authentication for all endpoints in the web API.
Apply versioning to api endpoints to manage data sharing and functionality, scheduling changes so new customers use newer versions while existing ones stay on older versions.
Install the NuGet package for versioning in the web api project by managing NuGet packages, selecting ASP.Net Core MVC versioning, and installing the latest stable release.
Introduce a second version of the web API by adding a required description to the shirt class, plus a v2 validate description method and an ensure description is present filter.
Run a database migration to add the description field to the shares table using the package manager console to add migration and update database, then verify the new column.
Configure API versioning to support multiple versions by setting a default version and routes, ensuring existing clients stay functional while validating with Postman and bearer tokens.
Implement api versioning through the http header using the api version reader, with the header x-api-version, and test versioned endpoints in Postman using bearer tokens.
Enable API version reporting in program.cs with options.reportApiVersions = true. After running the app, Postman headers show available versions 1.0 and 2.0; default is 1.0.
Explore route-based versioning in .net web APIs by configuring v1.0 and v2.0 routes in the shirts controller, and verify supported versions in the response header.
Learn how to version a .NET web API using a query string, compare header and route approaches, and verify updates across versions with practical examples.
Learn to enable multi-version swagger documentation in a web api by configuring the swagger ui and endpoint, adding the versioned api explorer, and using a triple v version format.
Configure and view multiple swagger document versions in .net by duplicating version settings, updating OpenAPI information, and using the version dropdown to access v1 and v2 endpoints.
Fix a bug in second version by updating the description field when patching a shirt. Verify the fix with swagger and postman using the access token in the authorization header.
Explore how to connect to Web API with multiple approaches, protect your Web API, and consume the API using Blazor WebAssembly, with guidance and answers available in the secure area.
Welcome to the Complete Guide to ASP.NET Core Web API in .NET 10 course, your ultimate resource for mastering Web API development using the ASP.NET Core platform. This course offers extensive coverage of Web API concepts, ensuring you gain a deep understanding of its technical aspects, security measures, and real-world implementation.
Why Choose our Course:
Are you looking for a course that goes beyond just teaching you how to code ASP.NET Core Web API? Look no further! Our course offers a unique learning experience that combines clear and logical explanations of theories with visually engaging diagrams. By understanding the "why" behind the code, you'll gain a deeper comprehension of the subject matter.
Not only will you master the art of creating ASP.NET Core Web API endpoints, but our course goes the extra mile by teaching you how to effectively consume them with ASP.NET Core MVC. This comprehensive approach ensures you have a well-rounded skill set that sets you apart from the competition.
In today's fast-paced world, the demand for backend APIs in modern applications is skyrocketing. By mastering ASP.NET Core Web API in .NET 10, you'll gain a significant advantage in your career development. Our meticulously designed course is tailored to equip you with the essential skills and knowledge needed to excel in job interviews and thrive in your current role.
What truly sets us apart is our instructor, Frank Liu. With over 20 years of experience as a senior software developer specializing in .NET technologies, Frank brings a wealth of practical knowledge to the table. You'll benefit from his real-world insights, industry best practices, and expert guidance throughout the course.
Don't miss this opportunity to boost your career prospects. Join our course today and unlock your full potential in the exciting world of ASP.NET Core Web API development.
Key Features:
7 hours of comprehensive video content covering all aspects of ASP.NET Core Web API in .NET 10
Learn essential topics such as ASP.NET Core Web API fundamentals, ASP.NET Core platform basics, routing, model binding, model validation, filter pipeline, versioning, OpenAPI/Swagger documentation, Entity Framework Core, and more
Hands-on exercises: Create a shirts store Web API, test it with Postman, and build an ASP.NET Core MVC app to consume the Web API
In-depth exploration of JWT token authentication and ASP.NET Core Web API security measures
Suitable for beginners: Covers ASP.NET Core MVC basics alongside Web API development
PREREQUISITES
- Intermediate Level of C# (at least 6 months of experience)
- Basic HTML
- It is best to know ASP.NET Core MVC, but if you don't have experience, I cover all the basics when building our app.
- You should know OOP and the concept of interface in C#.
Who Should Enroll:
C# developers eager to get started with Web API development in .NET 10
Developers seeking a comprehensive understanding of all aspects of Web API development
Professionals already working with Web API who want to fill in knowledge gaps
C# developers interested in learning ASP.NET Core MVC while gaining a complete understanding of Web API
Don't miss this opportunity to become a Web API expert in ASP.NET Core 10. Take your career to new heights and enroll in our Complete Guide to Web API in .NET 10 course today!