
- C#
- Intermediate
About this Course
Services expose data and processes through APIs (Application Programming Interfaces) implemented using common approaches or standards. Decoupling our back-end from our front-end makes it possible for our services to support multiple client apps. We can even allow other developers and organizations to consume and use our services to further broaden the reach of our applications.
In this course, you'll learn how to use the ASP.NET Web API framework to build a RESTful service or HTTP API. As you learn about Web API, you'll create a service for the Fitness Frog single-page web app (SPA) developed using Angular.
What you'll learn
- Designing a REST API
- Adding Web API to an Existing Project
- Defining Routes
- Adding API Controllers
- Implementing Validation
Planning Our Service
We'll start with an introduction to services and an overview of REST APIs before we start designing the API for the Fitness Frog Client App, a single-page web app built using Angular. Then we'll take a closer look at the Web API framework including an exploration of its request/response pipeline.
8 stepsBuilding Our Service
Let's add Web API to our project and add our first API controller! We'll see how to define a default route and explore how Web API's model binding maps incoming request data to our controller method parameters. We'll also see how content negotiation simplifies the serialization process while offering flexibility to our users.
7 stepsCompleting Our Service
Now we're ready to complete the service for the Fitness Frog Client App. Along the way we'll learn how to set up dependency injection, configure the JSON serializer, refine our responses, validate incoming data, and more!
9 steps-
Using Dependency Injection
7:55
-
Calling Our Repository Methods
3:23
-
Configuring the JSON Serializer
9:49
-
Refining Our Responses
7:54
-
Exercise: Adding the Activities and Intensities API Endpoints
6:24
-
Adding Validation
6:10
-
Using DTOs to Prevent Under-Posting
9:07
-
Testing Our DTOs
4:59
-
Section Review
5 questions
Teacher
-
James Churchill
Before joining the Treehouse team, James worked as a consultant for over 10 years doing web development using .NET and variety of open source technologies. James enjoys participating in the developer community, presenting at and attending meetups, code camps, and conferences. When not working, James enjoys learning, skiing, playing music, and watching movies.