---
title: PostJson / PutJson / PatchJson / DeleteJson
summary: Send a JSON request body via POST, PUT, PATCH, or DELETE and retrieve the response envelope.
status: draft
owner: bendy
last_reviewed: 2026-09-15
library: SAIF.Web.API.Clients
reference_type: package
operation_id: OP-04
trigger: Direct call by a consuming application
---

# PostJson / PutJson / PatchJson / DeleteJson

These four write methods are structurally identical, differing only in the `RestSharp.Method` they pass to the shared HTTP funnel (`POST`, `PUT`, `PATCH`, `DELETE`). `DeleteJson<T>` is the only delete overload — there is no body-less DELETE.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-04 |
| **Trigger** | Direct call by a consuming application. |
| **Inputs** | `methodUriSegment`, `object requestBody`. |
| **Outputs** | `ApiResponse<T>`. |
| **Primary components** | `JsonHttpClient.PostJson<T>`, `JsonHttpClient.PutJson<T>`, `JsonHttpClient.PatchJson<T>`, `JsonHttpClient.DeleteJson<T>` |
| **Entry point** | `src/SAIF.Web.API.Clients/JsonHttpClient.cs` |

## Steps

1. Execute the HTTP call with the supplied body through the shared funnel.
   - Embedded logic ([BR-CLI-001](../business-rules.md#br-cli-001-ntlm-default-authentication), [BR-CLI-002](../business-rules.md#br-cli-002-caller-identity-headers-required), [BR-CLI-003](../business-rules.md#br-cli-003-on-behalf-of-user-forwarding), [BR-CLI-005](../business-rules.md#br-cli-005-transient-failure-retry), [BR-CLI-006](../business-rules.md#br-cli-006-non-success-response-failure-conversion), [BR-CLI-010](../business-rules.md#br-cli-010-per-client-request-timeout), [BR-CLI-011](../business-rules.md#br-cli-011-date-time-zone-handling-consistency)):
     - Build the client, serialize the body, attach headers, execute, retry, and enforce success.

   > **Origin**: This step is implemented in [GetJsonResponse](get-json-response.md) (`SAIF.Web.API.Clients`) and executed on behalf of this operation.
   - Note: `requestBody` is not null-checked at this call site; `GetJsonResponse` skips `AddJsonBody` when it is `null`.
2. Project the transport response into `ApiResponse<T>` ([BR-CLI-009](../business-rules.md#br-cli-009-response-success-flag), [BR-CLI-012](../business-rules.md#br-cli-012-response-payload-shape-normalization), [BR-CLI-014](../business-rules.md#br-cli-014-responding-server-capture)).

   > **Origin**: This step is implemented in [GetApiResponse\<T\>](get-api-response.md) (`SAIF.Web.API.Clients`) and executed on behalf of this operation.

## Process flow

```mermaid
flowchart TD
	Start(["PostJson / PutJson /<br>PatchJson / DeleteJson<br>called"]) --> Funnel["Execute call with body<br>via GetJsonResponse"]
	Funnel --> Project["GetApiResponse&lt;T&gt;:<br>project into envelope"]
	Project --> EndOk(["Return<br>ApiResponse&lt;T&gt;"])
```

## Failure and edge-case behavior
- A `null` `requestBody` results in no JSON body being attached to the request rather than an error — valid for calls that carry no payload.
- Failure handling is identical to the GET-verb methods: a non-2xx/3xx status throws a typed `SAIFException` when `EnsureSuccessfulResponse` is enabled.

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

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