This is a piece of C# code that comes from a my program:
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(baseURL);
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
string userAndPasswordToken =
Convert.ToBase64String(Encoding.UTF8.GetBytes(user + ":" + key));
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization",
$"Basic {userAndPasswordToken}");
HttpContent httpContent = new StringContent(CUSTOMERJSONOBJECT, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(baseURL + "/companies(" + companyID + ")/customers", httpContent);
Here CUSTOMERJSONOBJECT is a JSON of a customer to create on D365BC.