Using HttpClient to Consume APIs in .NET Core
In this course you’ll get an in depth look at using HttpClient and HttpClientFactory to integrate with an API, from basic CRUD operations over streaming and compression to dealing with errors and extending HttpClient with custom message handlers.
What you'll learn
Applications, ranging from ASP.NET Core web apps over mobile Xamarin apps and Windows apps to Console apps often integrate with an API. For that, HttpClient is the default and best option. But there’s a lot more to using it than just sending a request and reading out the response. In this course, Using HttpClient to Consume APIs in .NET Core, you’ll get an in-depth look at using HttpClient and HttpClientFactory, from the internals over basic CRUD interaction to working with streams and compression. We’ll also cover cancelling requests that are no longer needed.
Additionally, you’ll learn how to use custom message handlers to improve the reliability of your requests and to unit test.
After this course, you'll know the ins and outs of integrating with an API from a variety of application types.
Table of contents
- Coming Up 1m
- Course Prerequisites 1m
- Frameworks and Tooling 1m
- Supported Platforms, Frameworks, and .NET Standard Versions 3m
- Platforms Implementing .NET Standard 2.0 1m
- Demo: Introducing the Demo Application 4m
- Strategies for Working with DTO Model Classes 2m
- Generating DTO Classes 2m
- Demo: Generating DTO Classes 6m
- Tackling Integration with HttpClient 5m
- Summary 2m
- Coming Up 1m
- Demo: Getting a Resource 8m
- Working with Headers and Content Negotiation 3m
- Demo: Manipulating Request Headers 4m
- Indicating Preference with the Relative Quality Parameter 1m
- Demo: Indicating Preference with the Relative Quality Parameter 3m
- Demo: Working with HttpRequestMessage Directly 3m
- Demo: Creating a Resource 3m
- Setting Request Headers 1m
- Inspecting Content Types 1m
- Demo: Updating a Resource 2m
- Demo: Deleting a Resource 1m
- Demo: Using Shortcuts 2m
- Summary 2m
- Coming Up 1m
- Advantages of Working with Streams 1m
- Using Streams When Reading Data 1m
- Demo: Using Streams When Reading Data 5m
- Improving Memory Use and Performance with HttpCompletionMode 1m
- Demo: Improving Memory Use and Performance with HttpCompletionMode 2m
- Demo: Improving Code Reuse with an Extension Method 2m
- Demo: Testing Performance Improvements When Reading Data 3m
- Using Streams When Sending Data 1m
- Demo: Using Streams When Sending Data 5m
- Using Streams When Sending and Reading Data 0m
- Demo: Combining Streams When Sending and Reading Data 4m
- Demo: Testing Performance Improvements When Sending Data 2m
- On Streaming, Memory Use, and Performance 2m
- Working with Compression 3m
- Summary 2m
- Coming Up 1m
- The Problem with Disposing HttpClient Instances: Part 1 1m
- Demo: The Problem with Disposing HttpClient Instances 5m
- The Problem with Disposing HttpClient Instances: Part 2 1m
- Introducing HttpClientFactory 2m
- Demo: Using HttpClientFactory to Manage HttpClient Instances 4m
- Demo: Using Named Instances and Defaults 2m
- Demo: Configuring the Primary Message Handler 2m
- Demo: Using Typed Instances 3m
- Demo: Using Typed Instances with Type-scoped Configuration 1m
- Demo: Extending Typed Instances with Interaction Methods 4m
- Summary 1m
- Coming Up 1m
- Delegating Handler Pattern 1m
- Implementing a Retry Policy 0m
- Demo: Implementing a Retry Policy 8m
- Implementing a Handler for Dealing with Time-outs 1m
- Demo: Implementing a Handler for Dealing with Time-outs 4m
- Other Use Cases for Delegating Handlers 1m
- Using Polly to Improve Interaction with an API 1m
- Summary 1m