Building an API with ASP.NET Core

The skill of building a web-facing API isn’t optional anymore. Whether you’re building a web site, mobile app, SPA, or enterprise tool, building a well-designed API is required.
Course info
Rating
(128)
Level
Beginner
Updated
Jan 9, 2019
Duration
2h 31m
Table of contents
Description
Course info
Rating
(128)
Level
Beginner
Updated
Jan 9, 2019
Duration
2h 31m
Description

As technology advances, the requirements do as well. In this course, Building an API with ASP.NET Core, you will learn foundational knowledge on how to build an API from start to finish. First, you will explore how to use ASP.NET Core to build reliable APIs. Next, you will discover REST and when to be pragmatic about it. Finally, you will learn how to version your APIs. When you are finished with this course, you will know how to implement an API that is easy to use, and easy to maintain.

About the author
About the author

Shawn Wildermuth has been tinkering with computers and software since he got a Vic-20 back in the early '80s. As a Microsoft MVP since 2002, he's also involved with Microsoft as an ASP.NET Insider and ClientDev Insider.

More from the author
Building an API with ASP.NET Web API
Intermediate
2h 42m
Mar 25, 2019
Less: Getting Started
Intermediate
1h 11m
Sep 19, 2018
More courses by Shawn Wildermuth
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Shawn Wildermuth, and welcome to my course, Building an API with ASP.NET Core. I'm a Microsoft MVP, instructor, and developer. The skill of building a web-facing API isn't optional anymore. Whether you're building a website, a mobile app, a SPA, or an enterprise tool, building a well-designed API is required. In this course, I'm going to introduce you to REST, we're going to design and build an API from start to finish, and show you how to version your API too. Some of the major topics we'll cover include use ASP.NET Core to build reliable APIs, understand REST and when to be pragmatic about it, how to use models and validation, and how to version your APIs. By the end of this course, you'll know how to implement an API that's easy to use and easy to maintain. Before beginning with this course, you should be familiar with ASP.NET Core and Entity Framework Core. I hope you'll join me on this journey to learn to create an API with ASP.NET Core with my Building an API with ASP.NET Core course here at Pluralsight.

Pragmatic Rest
Welcome to building an API with ASP.NET Core. My name is Shawn Wildermuth. In this module, we're going to start by talking about pragmatic REST. In this course, we will teach you creating an API using ASP.NET Core, creating API controllers, querying and modifying data, using association controllers, defining operational APIs or APIs that don't conform to data or entities, and then versioning your APIs with MVC 6. Currently, the course is built with Visual Studio 2017 version 15.9, ASP.NET Core 2.2, and Entity Framework Core 2.2. You can get each of these by going to get.asp .net. If you have questions during the course, I'll be available on the Discussion tab of this course. That's the best way to reach me, ask questions, help get unstuck, even find problems with your code. I check that virtually every day, and I try to keep on top of the questions. Just stop by the Discussion tab if you have any questions.

Building Your First API
So let's get started by building your first API. In ASP.NET Core, when you're building a web API it works in a very specific way. A request comes in from the server, and we have the route, which is essentially the path part of the URI. This may or may not include things like query strings, but mostly it's just the path to the endpoint on our server. ASP.NET Core then takes that route and tries to match it with existing routes that are found in the project. Once it's found a route, it looks at the action and controller for that route and executes it. When we talk about an action, we're really just talking about a method on a class. All these fancy words really come down to the controller being a class that has methods on it, and so a controller has methods that we call actions. Once that action is executed, we can then return the response of that action from the original request.

Creating Association APIs
In this next module, let's create some association APIs. What I mean by associations are APIs that are related to other resources. We've talked about this before with the idea that we have some camps, those camps that you can get an individual camp, and then to be able to get the related talks for that camp, and even an individual talk inside of that camp. In order to do this, we're actually going to segment this into two controllers. The existing controller we've already written, the CampsController, and then we're going to build a new one for dealing with talks. Even though you could build these all inside the CampsController, I find when you're dealing with different resources to segment your controllers based on resource even if they're related in this way. Let's see what that looks like.

Functional APIs
We've talked a lot about using resources in your APIs. And now let's talk about another topic, functional APIs.