# System.Web.Http

**Kind:** Service

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

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

NuGet package dependency

`System.Web.Http` is a NuGet package dependency in `Pams.API.csproj` for the legacy ASP.NET Web API layer. It supports HTTP API controllers, routing, request handling, and response generation for the Pams API.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as Pams.API
    participant WebHttp as System.Web.Http
    participant Controller

    Client->>Api: Send HTTP request
    Api->>WebHttp: Match route and create request context
    WebHttp->>Controller: Invoke API controller action
    Controller-->>WebHttp: Return HTTP response
    WebHttp-->>Api: Format response
    Api-->>Client: Send HTTP response
```

## Usage

```ts
async function getPamsRecord(recordId: string) {
  const response = await fetch(`/api/pams/${encodeURIComponent(recordId)}`, {
    headers: {
      Accept: "application/json",
    },
  });

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

  return response.json();
}
```

## AI Coding Instructions

- Treat `System.Web.Http` as a project dependency used by the server-side ASP.NET Web API application, not as a browser or Node.js package.
- Keep API routes and controller actions compatible with the legacy Web API pipeline configured by `Pams.API.csproj`.
- Return appropriate HTTP status codes and serialized response bodies from controller actions.
- Check existing package versions before changing this dependency, since legacy-format project files may use package references that affect other API components.
