title: How to construct the payload for Web API PATCH Method?
body: <p>I have a Web API written in .NET Core.</p>
  <p>The PATCH method uses [FromBody]JsonPatchDocument in the parameter:</p>
  <pre><code>[HttpPatch(&quot;{id}&quot;)]
  public Account Patch(int id, [FromBody]JsonPatchDocument&lt;Account&gt; accountPath)
  </code></pre>
  <p>I am able to execute all the methods (GET, PUT, POST, PATCH) from Postman or Swagger UI, but I am having a difficulty executing the PATCH method from a .NET client application.</p>
  <p>This is what I passed in to the Request Body for the PATCH method on Swagger UI or Postman:</p>
  <pre><code>[{&quot;op&quot;: &quot;replace&quot;,&quot;path&quot;: &quot;/Name&quot;,&quot;value&quot;: &quot;Test111&quot;}]
  </code></pre>
  <p>How do I pass the above payload in .NET client application ?</p>
  <p>When I do the below code, it doesn't give me an error, but the response was</p>
  <pre><code>{StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
  </code></pre>
  <p>This is my code:</p>
  <pre><code>using System.Net.Http;
  using Newtonsoft.Json;
  
  using (var client = new HttpClient(handler))
  {
     var AccountPayload = new Dictionary&lt;string, object&gt;
     {
        {&quot;Name&quot;, &quot;TEST111&quot;}
     };
     var content = JsonConvert.SerializeObject(AccountPayload);
     var request = new HttpRequestMessage(new HttpMethod(&quot;PATCH&quot;), &quot;https://localhost:5001/api/myAPI/1&quot;);
     request.Content = new StringContent(content, System.Text.Encoding.UTF8, &quot;application/json&quot;);
     HttpResponseMessage response = await client.SendAsync(request);
     var responseString = await response.Content.ReadAsStringAsync();
     return response; //--&gt; response = StatusCode: 400, ReasonPhrase: 'Bad Request'
  }
  </code></pre>
  <p>Thank you.</p>