Thursday, February 22, 2018

How do I do a patch request using HttpClient in dotnet core?

Thanks to Daniel A. White's comment, I got the following working.
using (var client = new HttpClient())
{       
    var request = new HttpRequestMessage(new HttpMethod("PATCH"), "your-api-endpoint");

    try
    {
        response = await client.SendAsync(request);
    }
    catch (HttpRequestException ex)
    {
        // Failed
    }
}


https://stackoverflow.com/questions/36023821/how-to-pass-the-following-json-to-a-c-sharp-patch-method-w-or-w-o-javascript-ser/36027802#36027802

No comments:

Post a Comment