Call Us: +32 2 466 00 16
Follow Us:

Building REST Services with ASP.NET Web API

3 days
3 days

Upcoming Sessions





Book now





Book now

Interested in a private company training? Request it here.


Roy Fielding, the inventor of REST, realized while using the HTTP protocol you can also use HTTP to work with data stored in a database. Here we will look at how REST uses HTTP to serve data instead of web pages.

  • The HTTP Protocol in Depth
  • How REST works

Introducing ASP.NET Core Web API

For .NET developers ASP.NET Core Web Api is the way to create REST services. Web API is an adapted version of ASP.NET MVC specifically designed for REST. This module serves as an overview of the framework.

  • Architecture
  • CRUD operations
  • Content Negotiation
  • Consuming with a .NET Client or fetch API

End-point Routing

On the web the URL decides what the server will do. In ASP.NET Core you will find the End-point Routing Middleware. A solid understanding of this middleware is required to build applications with ASP.NET Core.

  • Getting Started with Routing Concepts
  • Defining Routing Templates
  • Route Parameter Contraints
  • Route Parameter Transformers
  • Understanding Route Matching
  • Using Concentional vs. Attribute Routing
  • Routing Attributes
  • Handling Routing Errors

ASP.NET Core API Controllers

In this module we'll take a closer look at the C in MVC. The controller has a very important role to fulfill: It's the component that figures out what to do when receiving a request.

  • The ApiController Attribute and ControllerBase Class
  • Action Methods
  • Understanding IActionResult and ActionResult<T>
  • Using the ProblemDetails class for error reporting

Model Validation

People could be sending any data to your API. So you should always validate your input. Here we will look at validation options, and how to send feedback in case of errors.

  • Model Binding
  • The Modelstate
  • Validation Attributes
  • Returning Validation Errors
  • Avoiding Overposting with ViewModels

Serialization Options

Generally, in WebAPI we will use JSON as the serialization format. But how can we efficiently convert an object into JSON, and back again? Here we will look at classes from System.Text.Json, the latest and fastest JSON serialization library.

  • JsonSerializer, the new and fastest kid in town
  • Serialization options

Securing your Web API service

Security is a world on its own. In this module we'll explore the common techniques to secure your Web API.

  • Authentication & Authorization in Web API
  • Authorization Attributes and Policies
  • Authentication with OAuth and OpenID Connect
  • Working with Roles and Scopes

Documenting your REST service with the OpenAPI Specification

When you want to consume a REST service you are dependent on the documentation of the service. And developers don't like to write documentation. No problem: using Swagger you can automatically generate the necessary metadata for describing your service functionalities.

  • Swagger and Swashbuckle
  • Enriching your metadata with attributes
  • Enriching your metadata with comments
  • Adding XML-comments
  • Generating client-side code with Visual Studio and Swagger Codegen

Publishing Your Application

So you have finished a working version of your application. How do you deploy this? What are the options? Since .NET is cross-platform, you can build everything on Windows, and then run on Linux. We will also discuss various deployment options, such as assembly trimming.

  • Deployment Options
  • Cross-platform Deployment
  • Self-Contained Deployment
  • Self-Contained Deployment Options

Best Practices when Designing a Web API

Returning a 202 Accepted status code is easy. When to return it, that's another question. In this topic we'll dive into some best practices to create a properly designed API.

  • How to Organize Resources
  • Idempotency and Safeness
  • Dealing with Batches
  • Remote Procedure Calls
  • Limiting Data
  • Versioning
  • Handling Exceptions
  • Caching
  • Handling Large Resources

Web API Patterns

This topic contains some frequently used patterns and techniques when creating more complex APIs.

  • Asynchronous Request-Reply Pattern
  • WebHooks


Not only clothes, but even protocols get back in style. gRPC is a new take on the old RPC approach using highly efficient serilization with Protocol Buffers.

  • Protocol Buffers
  • Service Definitions with .proto files
  • Single Response vs Streaming
  • Consuming a gRPC Service

Getting your data from one side to the other. It's a persistent problem for developers. By using HTTP as the application protocol; REST is a reliable, performant and easy approach for building Web Services. ASP.NET Core Web API is Microsoft's answer to the growing demand, and is built up from the ground to alleviate REST development in both .NET Framework and .NET 5.

Participants of this course need to have a solid understanding of the .NET platform and have built .NET applications using either C# or VB.NET. Knowledge about ASP.NET MVC (.NET Framework or .NET 5) or ASP.NET in general is a plus.

© 2020 U2U All rights reserved.