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¶
- Execute the HTTP call with the supplied body through the shared funnel.
- Embedded logic (BR-CLI-001, BR-CLI-002, BR-CLI-003, BR-CLI-005, BR-CLI-006, BR-CLI-010, BR-CLI-011):
- Build the client, serialize the body, attach headers, execute, retry, and enforce success.
Origin: This step is implemented in GetJsonResponse (
SAIF.Web.API.Clients) and executed on behalf of this operation. - Note:requestBodyis not null-checked at this call site;GetJsonResponseskipsAddJsonBodywhen it isnull. 2. Project the transport response intoApiResponse<T>(BR-CLI-009, BR-CLI-012, BR-CLI-014).Origin: This step is implemented in GetApiResponse\<T> (
SAIF.Web.API.Clients) and executed on behalf of this operation.
Process flow¶
flowchart TD
Start(["PostJson / PutJson /<br>PatchJson / DeleteJson<br>called"]) --> Funnel["Execute call with body<br>via GetJsonResponse"]
Funnel --> Project["GetApiResponse<T>:<br>project into envelope"]
Project --> EndOk(["Return<br>ApiResponse<T>"])
Failure and edge-case behavior¶
- A
nullrequestBodyresults 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
SAIFExceptionwhenEnsureSuccessfulResponseis enabled.
Related documentation¶
Sources¶
src/SAIF.Web.API.Clients/JsonHttpClient.cs