ASP.NET Core Web API Development
Learn to build production-ready REST APIs with ASP.NET Core. From HTTP basics through authentication, testing, and deployment — build a complete API from scratch.
View badge details
About This Course
A comprehensive course on building production-ready REST APIs with ASP.NET Core. Covers HTTP fundamentals, controllers, routing, Entity Framework Core, dependency injection, validation, JWT authentication, authorization, testing, caching, rate limiting, and deployment. Students progressively build a TaskFlow API from scratch, then apply all patterns to a capstone project.
Course Curriculum
26 Lessons
01
AI Lesson
Introduction to Web APIs and REST
02
Lab Exercise
Introduction to Web APIs - Lab Exercises
Explore the ASP.NET Core Project Structure
Run the starter project, test the root endpoint, and explore the key files that make up an ASP.NET Core Web API application.
~15 min
Add OpenAPI/Swagger Support
Install Swashbuckle, configure Swagger middleware, and explore your API through an interactive documentation UI.
~20 min
Build Your First API Endpoints
Create GET and POST minimal API endpoints that return JSON, accept route parameters, and echo request bodies.
~25 min
Working with HTTP Methods and Status Codes
Build a notes API with GET, POST, and DELETE endpoints that return proper HTTP status codes for each operation.
~20 min
03
AI Lesson
Minimal APIs vs Controllers
04
Lab Exercise
Minimal APIs and Controllers - Lab Exercises
Create Your First Controller
Create a TaskItem model and a TasksController with the ApiController attribute, then wire up controller routing in Program.cs.
~20 min
Implement Full CRUD Operations
Add GET by ID, POST with CreatedAtAction, PUT, and DELETE actions to the TasksController with proper HTTP status codes.
~25 min
Compare Minimal APIs and Controllers
Implement the same task list endpoint as both a minimal API and a controller, then compare the two approaches side by side.
~15 min
05
AI Lesson
Routing, Parameters, and Model Binding
06
Lab Exercise
Routing and Model Binding - Lab Exercises
Add Query String Filtering
Add filtering to GET /api/tasks using [FromQuery] parameters for status, priority, and search
~20 min
Implement PUT and DELETE
Add PUT and DELETE endpoints with route constraints and proper status codes
~20 min
Advanced Parameter Binding
Use [FromHeader] and [FromQuery] for request IDs and pagination
~20 min
07
AI Lesson
Data Models, DTOs, and AutoMapper
08
Lab Exercise
DTOs and AutoMapper - Lab Exercises
Create Data Transfer Objects
Create separate DTOs for create, update, and response operations
~20 min
Install and Configure AutoMapper
Set up AutoMapper with mapping profiles for TaskItem and DTOs
~20 min
Refactor Controller to Use DTOs
Replace TaskItem with DTOs in all controller actions using AutoMapper
~25 min
09
AI Lesson
Entity Framework Core Integration
10
Lab Exercise
Entity Framework Core - Lab Exercises
Set Up EF Core with SQLite
Install EF Core packages, create a DbContext, configure entity mappings, and create the initial database migration.
~25 min
Add the Category Entity
Create a Category model, configure the one-to-many relationship with TaskItem, seed initial data, and apply a new migration.
~20 min
Refactor Controller to Use EF Core
Replace the in-memory static list with async EF Core queries, use eager loading for related data, and update DTOs.
~30 min
Create a Categories Controller
Build a full CRUD controller for categories with task count aggregation and test the complete API.
~20 min
11
AI Lesson
Dependency Injection and the Service Layer
12
Lab Exercise
Service Layer and DI - Lab Exercises
Create the Repository Layer
Define a repository interface and implement it with EF Core to encapsulate data access logic.
~25 min
Create the Service Layer
Build a service layer that encapsulates business logic, uses the repository for data access, and AutoMapper for DTO transformations.
~25 min
Refactor the Controller
Refactor the TasksController to use ITaskService instead of DbContext, achieving thin controllers with clean separation of concerns.
~25 min
13
AI Lesson
Input Validation and Error Handling
14
Lab Exercise
Validation and Error Handling - Lab Exercises
Add Data Annotations Validation
Add validation attributes to DTOs and observe how [ApiController] triggers automatic model validation.
~15 min
Implement FluentValidation
Replace basic data annotations with FluentValidation for more powerful, testable validation rules.
~25 min
Build Global Exception Handling
Create custom exceptions and middleware to return consistent ProblemDetails JSON for all error responses.
~25 min
15
AI Lesson
Authentication with JWT Bearer Tokens
16
Lab Exercise
JWT Authentication - Lab Exercises
Configure JWT Authentication
Install the JWT Bearer package and configure authentication middleware with token validation parameters.
~20 min
Create the Auth Controller
Build a user model, auth service with JWT generation, and login endpoint.
~25 min
Protect Your API Endpoints
Apply [Authorize] and [AllowAnonymous] attributes and test token-based access control.
~20 min
Associate Tasks with Users
Add user ownership to tasks so each user only sees their own data.
~20 min
17
AI Lesson
Authorization — Roles, Policies, and Claims
18
Lab Exercise
Authorization - Lab Exercises
Implement Role-Based Authorization
Add role claims to JWT tokens and restrict the DELETE endpoint to Admin users only
~20 min
Create Authorization Policies
Build custom authorization policies with requirements and handlers to enforce task ownership
~25 min
Build an Admin Dashboard Endpoint
Create an admin-only endpoint that returns all users tasks with user information
~15 min
19
AI Lesson
OpenAPI/Swagger, Logging, and Middleware
20
Lab Exercise
Swagger, Logging, and Middleware - Lab Exercises
Enrich Swagger Documentation
Add XML comments, response type attributes, and JWT authentication to Swagger UI
~20 min
Create Custom Middleware
Build request timing and correlation ID middleware components for the HTTP pipeline
~25 min
Configure Strongly-Typed Settings
Use the Options pattern to bind configuration values and inject them into controllers
~20 min
21
AI Lesson
Testing ASP.NET Core APIs
22
Lab Exercise
Testing APIs - Lab Exercises
Set Up the Test Project
Create an xUnit test project, add project references, and install testing packages.
~20 min
Write Unit Tests for TaskService
Write unit tests for the TaskService using Moq to mock dependencies and verify business logic.
~30 min
Write Integration Tests
Write integration tests using WebApplicationFactory to test the full HTTP pipeline including authentication.
~30 min
23
AI Lesson
Pagination, Caching, Rate Limiting, and CORS
24
Lab Exercise
Advanced Features - Lab Exercises
Implement Pagination
Add pagination support to the tasks API with a reusable PagedResult class.
~25 min
Add Sorting and Filtering
Add dynamic sorting with whitelisted property names and descending/ascending order support.
~20 min
Configure Rate Limiting
Add fixed-window rate limiting with per-user partitioning to protect API endpoints.
~20 min
Configure CORS
Configure Cross-Origin Resource Sharing to allow frontend applications to call the API.
~15 min
25
AI Lesson
Capstone Briefing — Building a Production API
26
Lab Exercise
Capstone Project — BookShelf API
Build the BookShelf API
Apply all course patterns to build a complete library management API from requirements alone.
~90 min
Test and Document Your API
Write unit and integration tests, add XML documentation, and perform final verification.
~30 min