liveBook · Manning

Contract

As explained in ASP.NET Core in Action, 3e

A web API is an HTTP-accessible application interface that exposes operations or data to clients.

A web API is an HTTP-accessible application interface that exposes operations or data to clients. ASP.NET Core web APIs support RESTful or HTTP-based applications, including mobile apps, browser single-page applications, and other backend services. section 1.2 section 1.6

Web APIs add more structure and features than minimal APIs. Both use ASP.NET Core’s shared foundations, while the appropriate choice depends on application requirements, existing systems, clients, scalability, and uptime. section 1.2 section 2.3

Figure 2.5 ASP.NET Core can act as the server-side application for a variety of clients: it can serve HTML pages for traditional web applications, act as a REST API for client-side SPA applications, or act as an ad hoc RPC service for client applications.
CH02_F05_Lock3

Shows how one ASP.NET Core server can serve HTML pages, expose a REST API for a client-side SPA, or provide an RPC service to client applications. section 2.3

Apply the concept across common API situations:

  • Serve data and operations to a mobile application or browser-based single-page application. section 1.2
  • Provide an interface for other backend services, where browser protections cannot be assumed. section 28.4.3
  • Use HTTPS-only listening for API applications so clients cannot accidentally send requests over HTTP. section 28.4.3

A single server, several clients

An ASP.NET Core application can render HTML for a traditional website while also exposing a REST API consumed by a browser SPA or mobile application. A separate backend service can call the same API over HTTPS. section 2.3 section 28.4.3

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines API paradigms and client contexts, then addresses HTTPS configuration without detailing endpoint implementation.
Examples
Uses mobile applications, browser SPAs, backend services, and a multi-client ASP.NET Core server as examples.
What it assumes
Assumes HTTP request-and-response basics while introducing API clients and ASP.NET Core paradigms.
What you can do after
Builds RESTful or HTTP APIs with ASP.NET Core and selects a suitable paradigm for different clients.
How it connects
Connects web APIs with minimal APIs, REST, HTTP, gRPC, ASP.NET Core, HTTPS, and browser single-page applications.

Also explained in

Compare how 44 books explain contract →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.