Using HttpClient to perform a Patch Method to the Update User Endpoint

Hi

I am using the .NET HttpClient to perform my Managment API calls. I realize that to perform an update on a user one has to invoke the PATCH method. I’m having a difficult time figuring how to implement code that that accomplishes this. Can anyone provide examples?

This is what I have so far. I receive a 400 response error.

       var method = new HttpMethod("PATCH");
       var request = new HttpRequestMessage(method, requestUri)
       {
           Content = iContent
       };

       HttpResponseMessage response = new HttpResponseMessage();
       try
       {
           response = await client.SendAsync(request);
       }

Here is my Json contained within iContent

{
  "blocked": false,
  "email_verified": false,
  "email": "john.doe@gmail.com",
  "phone_number": "+199999999999999",
  "phone_verified": false,
  "user_metadata": {},
  "app_metadata": {},
  "verify_email": false,
  "verify_phone_number": false,
  "password": "secret",
  "connection": "Initial-Connection",
  "client_id": "DaM8bokEXBWrTUFCiJjWn50jei6ardyX",
  "username": "johndoe"
}

I found the solution at the following links:

Stackoverflow 1
Stackoverflow 2