Kind: Service
Source: Pams/API/Pams.API/Pams.API.csproj (line 1)
Part of: Pams
NuGet package dependency
System.Net.Http.Formatting is a NuGet dependency in the Pams.API project for HTTP media-type formatting in legacy ASP.NET Web API. It handles serialization and deserialization of request and response bodies, including JSON payloads, during API processing.
Diagram
mermaidsequenceDiagram participant Client participant PamsAPI as Pams.API participant Formatting as System.Net.Http.Formatting Client->>PamsAPI: Send HTTP request with JSON body PamsAPI->>Formatting: Deserialize request content Formatting-->>PamsAPI: Return model object PamsAPI->>Formatting: Serialize response content Formatting-->>Client: Return HTTP response with JSON body
Usage
tstype PamsRecord = {
id: string;
name: string;
};
async function getPamsRecord(id: string): Promise<PamsRecord> {
const response = await fetch(`/api/pams/${encodeURIComponent(id)}`, {
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`Pams.API request failed: ${response.status}`);
}
return response.json() as Promise<PamsRecord>;
}
AI Coding Instructions
- Keep
System.Net.Http.Formattingreferences aligned with the legacy ASP.NET Web API pipeline inPams.API. - Ensure API clients send
Content-Type: application/jsonfor JSON request bodies and request JSON responses withAccept: application/json. - Check formatter configuration before changing serialization behavior, including property naming and null-value handling.
- Avoid removing the package while controllers or configuration still depend on media-type formatter types.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Injected or called by (1)
Pams.API—Pams/API/Pams.API/Pams.API.csproj:1
Was this page helpful?