ASP.NET Core MVC & Razor Pages

API Integration Samples and Documentation

API Integration Samples

Explore these practical examples showcasing how to integrate with external APIs using ASP.NET Core MVC and Razor Pages. Learn best practices for making HTTP requests, handling responses, and managing data.

Featured Samples

Consuming a RESTful Weather API

This sample demonstrates how to fetch real-time weather data from a public API. It covers request construction, JSON deserialization using System.Text.Json, and displaying the data in a user-friendly format.

HTTP Client REST API JSON Serialization MVC

Integrating with a Product Catalog API

Learn how to interact with a backend API that manages product information. This sample includes handling different HTTP methods (GET, POST, PUT, DELETE), error handling, and creating simple CRUD operations within your ASP.NET Core application.

HttpClientFactory CRUD Operations Error Handling Razor Pages

Authentication and Authorization with APIs

This sample focuses on secure API integration, covering common authentication schemes like API keys and OAuth 2.0. It shows how to include authentication tokens in your requests and handle authorized responses.

Authentication Authorization API Keys OAuth 2.0 Security

Asynchronous API Calls with Parallelism

Discover how to perform multiple API requests concurrently using asynchronous programming and Task.WhenAll. This improves application responsiveness and performance by reducing waiting times.

Async/Await Parallelism Performance HttpClient

Key Concepts and Best Practices

When integrating with APIs in ASP.NET Core MVC and Razor Pages, consider the following:

Useful Resources