• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Resolved 415 Unsupported Media Type

desaPax

New Pleskian
Server operating system version
Microsoft Windows Server 2022
Plesk version and microupdate number
Plesk Obsidian v18.0.62_build20240724.14 os_Windows 2012/2016/2019/2022
For a few days now, when I try to install LetsEncrypt certificates, I get the error 415 Unsupported Media Type only in that call. I have tried other calls and they don't give an error. It only gives it in that one.
I use C# to make the calls. I attach the code

private void InitializeClient()
{

apiClient = new HttpClient();
apiClient.BaseAddress = new Uri(hostUrl);
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
apiClient.DefaultRequestHeaders.Clear();
apiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
ServicePointManager.MaxServicePointIdleTime = int.MaxValue;
var byteArray = Encoding.ASCII.GetBytes(string.Format("{0}:{1}", user, pass));
apiClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

}
//NO WORKS
public async Task<APIResult> InstalarRenvarSSL(string dominio)
{
var ls = new SSLParams();
List<string> @params = new List<string>();
@params.Add("--exec");
@params.Add("letsencrypt");
@params.Add("cli.php");
@params.Add("-d");
@params.Add(dominio);
if (dominio.StartsWith("www."))
{
@params.Add("-d");
@params.Add(dominio.Replace("www.",""));
}
@params.Add("-m");
@params.Add("[email protected]");
ls.@params = @params;
StringContent cont = new StringContent(JsonConvert.SerializeObject(ls));
using (HttpResponseMessage response = await apiClient.PostAsync("/api/v2/cli/extension/call", cont))
{

if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<APIResult>(content);
return result;
}
else
throw new Exception(response.ReasonPhrase);
}
}

//THIS WORKS
public async Task<bool> ObtExtensiones()
{
using (HttpResponseMessage response = await apiClient.GetAsync("/api/v2/extensions"))
{
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
//var result = JsonConvert.DeserializeAnonymousType<>(content);
return true;
}
else
throw new Exception(response.ReasonPhrase);
}
}
 
Yes, I've seen that post, but that's not my case. In fact, I already send the application/json mime type in the calls.
Also, other calls such as listing the extensions in the /api/v2/extensions panel work perfectly.
Only the one that allows me to install SSL using LetsEncryp fails.
 
I've solved it now. It seems that you now have to indicate the data type in the string that is sent when making the request.

//NO WORKING
StringContent cont = new StringContent(JsonConvert.SerializeObject(ls));

//WORKS
StringContent cont = new StringContent(JsonConvert.SerializeObject(ls), Encoding.UTF8,"application/json");
 
Back
Top