# System.Web.Http

**Kind:** Service

**Source:** `Pams/Core/Pams.Core/Pams.Core.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`System.Web.Http` is a NuGet package dependency in `Pams.Core.csproj` for ASP.NET Web API types and HTTP request handling. It supports the legacy .NET web API layer that receives HTTP requests, routes them to controllers, and returns HTTP responses.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as ASP.NET Web API
    participant Controller
    participant Core as Pams.Core

    Client->>Api: HTTP request
    Api->>Controller: Route request to controller action
    Controller->>Core: Call application logic
    Core-->>Controller: Return result
    Controller-->>Api: Create HTTP response
    Api-->>Client: HTTP response
```

## Usage

```ts
type PamsRecord = {
  id: string;
  name: string;
};

export async function getPamsRecord(id: string): Promise<PamsRecord> {
  const response = await fetch(`/api/pams/${encodeURIComponent(id)}`, {
    method: "GET",
    headers: {
      Accept: "application/json",
    },
  });

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  return response.json();
}
```

## AI Coding Instructions

- Keep `System.Web.Http` references aligned with the legacy ASP.NET Web API stack used by `Pams.Core`.
- Route client requests through existing API controllers rather than calling `Pams.Core` directly from browser code.
- Return HTTP status codes and JSON response bodies that match the controller contract.
- Avoid mixing ASP.NET Web API types with ASP.NET Core MVC types in the same integration path.
