---
title: GetApiResponse<T>
summary: Project a transport-level JsonResponse into the public ApiResponse<T> envelope.
status: draft
owner: bendy
last_reviewed: 2026-09-15
library: SAIF.Web.API.Clients
reference_type: package
operation_id: OP-06
trigger: GetResponse<T> and the write operations
---

# GetApiResponse<T>

`GetApiResponse<T>` converts the internal transport-level `JsonResponse` into the public [SAIF.Web.API.Core](../../saif-web-api-core/overview.md) `ApiResponse<T>` envelope that consumers actually receive.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-06 |
| **Trigger** | [GetResponse\<T\>](get-response.md) step 2; [PostJson/PutJson/PatchJson/DeleteJson](write-operations.md) step 2. |
| **Inputs** | Internal `JsonResponse`. |
| **Outputs** | `ApiResponse<T>`. |
| **Primary components** | `JsonHttpClient.GetApiResponse<T>(JsonResponse)` (private) |
| **Entry point** | `src/SAIF.Web.API.Clients/JsonHttpClient.cs` |

## Steps

1. `Results = GetContentArray<T>(jsonResponse.Content, DateTimeZoneHandling)` ([BR-CLI-012](../business-rules.md#br-cli-012-response-payload-shape-normalization)).
   - Embedded logic: normalize the JSON payload (array, object, or scalar) into `T[]`.

   > **Origin**: This step is implemented in [GetContentArray\<T\>](get-content-array.md) (`SAIF.Web.API.Clients`) and executed on behalf of this operation.
2. `Server` = value of the first response header named `Server-Name`, else `null` ([BR-CLI-014](../business-rules.md#br-cli-014-responding-server-capture)).
   - The header-name match is case-sensitive ordinal (`x.Name == "Server-Name"`).
3. `StatusCode` = the transport status.
   - Copied verbatim, including `0` for transport failures when `EnsureSuccessfulResponse` is `false`.
4. `Version` = `jsonResponse.Version`.
   - Always `null`, because `GetJsonResponse` never populates it.

## Process flow

```mermaid
flowchart TD
	Start(["GetApiResponse&lt;T&gt;<br>called"]) --> Results["Results =<br>GetContentArray&lt;T&gt;"]
	Results --> Server["Server = Server-Name<br>header, else null"]
	Server --> Status["StatusCode = transport<br>status"]
	Status --> Version["Version =<br>jsonResponse.Version,<br>always null"]
	Version --> EndOk(["Return<br>ApiResponse&lt;T&gt;"])
```

## Failure and edge-case behavior
- `ApiResponse<T>.Version` is always `null`.
- `ApiResponse<T>.Server` is `null` whenever the response does not include a `Server-Name` header, or when the header name's casing differs from the expected literal.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `src/SAIF.Web.API.Clients/JsonHttpClient.cs`
