---
title: Handle a Security API response
summary: "Centralizes response handling for every SecurityApi GET call: deserializes a successful response, or throws a `SecurityClientException` wrapping the error for any non-successful response."
status: draft
owner: Framework.NCore maintainers
last_reviewed: 2026-10-02
library: SAIF.NetCore.AuthService
reference_type: package
operation_id: OP-15
trigger: Any `SecurityClient` method (OP-04 through OP-08) completes its underlying remote GET call.
---

# Handle a Security API response

Centralizes response handling for every SecurityApi GET call: deserializes a successful response, or throws a `SecurityClientException` wrapping the error for any non-successful response.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-15 |
| **Trigger** | Any `SecurityClient` method (OP-04 through OP-08) completes its underlying remote GET call. |
| **Inputs** | A `urlPath` and the underlying `IHttpRequestResult`/`IHttpJsonClient` response. |
| **Outputs** | The deserialized `T` result, or a thrown `SecurityClientException`. |
| **Primary components** | `SecurityClient.HandleSecurityServiceGetResponse<T>` |
| **Entry point** | `src/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/Clients/SecurityClient.cs` |

## Steps

1. `await HttpClient.GetAsync(urlPath)` via the injected `IHttpJsonClient`.
2. If `result.IsSuccessful`, return `result.GetResult<T>()`; otherwise throw `new SecurityClientException(result.ErrorMessage, result.ErrorException)` when `ErrorException` is not null, or `new SecurityClientException(result.ErrorMessage)` otherwise ([BR-AUTH-011](../business-rules.md#br-auth-011-a-non-successful-securityapi-response-always-throws))

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
    Start([GET request completes]) --> Success{IsSuccessful?}
    Success -->|Yes| Return([Return deserialized result])
    Success -->|No| HasInner{ErrorException present?}
    HasInner -->|Yes| ThrowInner([Throw SecurityClientException with inner exception])
    HasInner -->|No| ThrowPlain([Throw SecurityClientException with message only])
```

## Failure and edge-case behavior

- There is no null/false/default fallback for a non-successful response; every caller must be prepared to catch `SecurityClientException`.

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

## Sources
- `src/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/SAIF.NetCore.AuthService/Clients/SecurityClient.cs`
