Calling HttpClient from Customization

I’ve the following source code:

using System.Net;
using System.Net.Http;

public class  Script
{
  private HttpClient _client = new HttpClient();
  private WebClient _client2 = new WebClient();
}

When I test that code I got the error below:
Compiling Custom Code …

----------errors and warnings------------

 Error: CS0246 - line 82 (2235) - The type or namespace name 'HttpClient' could not be found (are you missing a using directive or an assembly reference?)

So, can we use HttpClient in customization? As the MS recommendation for using HttpClient instead WebClient:

We don’t recommend that you use the WebClient class for new development. Instead, use the System.Net.Http.HttpClient class. (https://docs.microsoft.com/en-us/dotnet/api/system.net.webclient?view=netframework-4.7.2)

Can you throw us what your end goal is? Generally this isn’t a great idea

Thanks Jose for your comment. So, the end of my goal is I want to develop customization and the customization cannot save to UD table (this is restriction from my company). So, I want to save the customization data using Web API that I called with HttpClient/WebClient.

Solved by the following article: How to post JSON to a server using C#? - Stack Overflow. I am using HttpWebRequest to call web service.