liveBook · Manning

Endpoint

As explained in .NET in Action, Second Edition

An endpoint is a network-accessible interface that receives requests and returns responses for a defined operation or resource.

An HTTP endpoint is a network-accessible API interface that receives a request and returns data for a defined operation or resource. An air-conditioning unit exposes measurements to a central controller and site owners, returning its latest recorded sensor values. section 12.1

A practical endpoint implementation defines:

  • A route containing the site and unit identifier, such as /measure/TIJ1/1. section 12.1
  • An HTTP GET action that binds route values and returns a Temperatures object. section 12.1
  • A response model containing the unit ID, site, UTC timestamp, and sensor measurements. section 12.1

Reading unit measurements

A client requests GET /measure/TIJ1/1. The endpoint responds successfully with the unit's latest exhaust-air, coolant, and outside-air measurements, represented as JSON. section 12.1

Listing 12.1 Example response from the air conditioner's API
{
  "UnitId": 1,                                     #1
  "Site": "TIJ1",
  "Timestamp": "2022-10-10T00:05:00.000Z",         #2
  "Measurements": {
    [
      "SensorName": "ExhaustAirTemp",              #3
      "Value": 15.2,
      "Description": "Exhaust Air Temperature"     #4
    ],
    [
      "SensorName": "CoolantTemp",
      "Value": 3.4,                                #5
      "Description": "Coolant Temperature"
    ],
    [
      "SensorName": "OutsideAirTemp",
      "Value": 24.1,
      "Description": "Outside Air Temperature"
    ]
  }
}

Inspect the representative JSON payload, including unit identity, UTC timestamp, and named measurement values. section 12.1

Endpoint behavior can be checked through an ASP.NET Core test host: create a WebApplicationFactory, issue an HttpClient GET request, and assert an OK status. section 12.1

How .NET in Action, Second Edition covers it

How deep it goes
Implements routing, parameter binding, response modeling, JSON output, and an HTTP integration test.
Examples
Uses /measure/TIJ1/1 to return the latest exhaust-air, coolant, and outside-air measurements.
What you can do after
Builds and tests a C# ASP.NET Core endpoint that returns typed measurement data.
How it connects
Connects ASP.NET Core web APIs, HTTP GET, route parameters, JSON responses, UTC timestamps, and integration testing.

Also explained in

Compare how 26 books explain endpoint →

Related concepts

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