What is a Minimal Web API?
Build a Minimal Web API Project
Use PostMan and Swagger to Test API Calls
Using the MapGet(), MapPost(), MapPut() and MapDelete() Methods
Build a Router Base Class to Simplify Your Minimal APIs
Add Logging to your Web API Calls
Add Exception Handling to your Web API Calls
Develop a Complete Set of CRUD APIs
Call your Web APIs from JavaScript/jQuery
Add CORS to Allow Cross-Domain Calls
Securing Minimal Web APIs
Creating Asynchronous API Calls
Introduction
Introduction
Web API Fundamentals
What is a Web API
HTTP Status Codes and Verbs
ASP.NET and It’s Components
Routes, Endpoints and Dependency Injection
Middleware Fundamentals
Minimal Web API Overview
MVC Web API Overview
Test your knowledge of Web APIs
Create a Web API Project and Test using Swagger/Postman
Create a Minimal API Project Using VS Code
Create a Minimal API Project Using Visual Studio 2022
Using Postman to Test APIs
Add Swagger/Open API Support to VS Code
Add Swagger/Open API Support to Visual Studio 2022
Comment the Program.cs File for Better Readability
Test your knowledge of creating and testing a Web API project.
Finished Lab Samples
Sample Code Demonstrated in this Section
Routes and Return Types
Creating Your First Minimal APIs
Specifying Return Types
Return an Object
Return a List of Product Objects
Return a Single Product from Repository
Return a 404 Not Found for a Single Product
Return a 404 Not Found for List of Products
Grouping APIs
Documenting Return Values
Test your knowledge of Routes and Return Types
Lab: Starting Code
Finished Lab Samples
Sample Code Demonstrated in this Section
Using Dependency Injection
Dependency Injection Overview
Service Lifetimes
Create a Settings Class and Use as a Scoped Lifetime
Differences Between Scoped and Singleton Settings
Using an Interface in Dependency Injection
Test your knowledge of Dependency Injection
Finished Lab Samples
Sample Code Demonstrated in this Section
Organize your APIs Using Router Classes
Using a Router Class
Create Router Base Class and Product API Router Class
Get Single Product in Router Class
Injecting Into Router Classes
Create the Simple API Router Class
Create the Settings API Router Class
Test your knowledge of using Router classes.
Finished Lab Samples
Sample Code Demonstrated in this Section
Add Logging to Web API Calls
How Logging Works in Web API Projects
Logging Messages to the Console Window
Setting the Log Level Through the Configuration File
Logging an Object Using the JSON Serializer
Logging to a Text File Using Serilog
Test your knowledge of Logging.
Finished Lab Samples
Sample Code Demonstrated in this Section
Add Exception Handling to Web API Calls
Built-In Exception Handling
Exception Router Class
Development and Production Exception Handling
Different Profiles for Development and Production
Handling 404 Status Codes
Log Exceptions Into a Different File
Log Exceptions in a Catch Block
Test your knowledge of Exception Handling
Finished Lab Samples
Sample Code Demonstrated in this Section
Modify RouterBase Class to Reduce Duplicate Code
Add Properties to Router Base Class
Add Exception Handling to RouterBase
Add a Serialize Entity Method
Test your knowledge of the RouterBase class
Finished Lab Samples
Sample Code Demonstrated in this Section
Reading Configuration Settings Efficiently
Configuration Providers and JSON Files
Reading Settings Individually
Read Settings into a Class
Assign Config Settings Directly to Object
Read Settings in Program.cs
Test your knowledge of Configuration Settings
Finished Lab Samples
Sample Code Demonstrated in this Section
Configure and Format JSON Data
Formatting JSON Using Attributes
Format JSON Using Configuration Options
Ignore Read-Only Properties & Customer Formatters
Test your knowledge of Formatting JSON data.
Finished Lab Samples
Sample Code Demonstrated in this Section
Call Mimimal Web APIs From Client-Side and Setup CORS
Create an MVC Website
Call a Web API from JavaScript/jQuery
Add CORS to Enable Cross Domain Calls
Test your knowledge of CORS
Finished Lab Samples
Sample Code Demonstrated in this Section
Organizing the Program.cs File for Readability
Create a Constants Class
Create Extension Methods
Extension Methods for JSON and Serilog Configuration
Extensions for Settings, Repository, and Router Classes
Finished Lab Samples
Sample Code Demonstrated in this Section
Securing Web APIs with JSON Web Tokens
Security in ASP.NET
Add and Configure Authentication and Authorization
An Explanation of JSON Web Tokens
Add JWT to your Web API Project
Register JWT Authentication with ASP.NET
Create Security Classes
Create Security Manager Class for Authentication
Generate JWT and Authenticate User
Display Contents of JWT at jwt.io
Add JWT Support in Swagger
Secure an Endpoint Using Claims
Handling 401 and 403 Status Codes
Test your knowledge of ASP.NET security
Finished Lab Samples
Sample Code Demonstrated in this Section
Get Data From a Database Using the Entity Framework
Install the Entity Framework into your Project
Add Data Annotations to Product Class
Create DbContext Class and Add Connection String
Add DbContext Class to Services Container
Get Products from the SQL Server Table
Get a Product from the SQL Server Table
Test your knowledge of the Entity Framework
Finished Lab Samples
Sample Code Demonstrated in this Section
Adding, Editing, Deleting, and Validating Data
Add Modification Methods to Repository Class
Add Insert Method to Product Classes
Add Update Method to Product Classes
Add Delete Method to Product Classes
Add Validation Data Annotations to Product Class
Add a Validation Helper Class
Modify the Insert() Method to Check Validation
Modify the Update() Method to Check Validation
Finished Lab Samples
Sample Code Demonstrated in this Section
Create Reusable Searching Methods
Create a SearchBase and ProductSearch Class
Add BindAsync() Method to Search Class
Add Search Methods to Product Repository
Add Search Methods to IRepository Interface
Add Search Route and Test
Finished Lab Samples
Sample Code Demonstrated in this Section
Making Asynchronous API Calls
Introduction to Asynchronous
How Asynchronous Web API Calls Work
Introduction to async, await and Task<T>
A Simple Sync/Async Demonstration
Getting All Products Asynchronously
Get a Single Product Asynchronously
Add all Other CRUD Asyncronous Calls
Test your knowledge of Asynchronous programming
Finished Lab Samples
Sample Code Demonstrated in this Section