SSL Issue while connecting with third party web api

By: sarvjeet kaur | Asked: 01/02/2025
ForumsCategory: 3rd Party ResourcesSSL Issue while connecting with third party web api
sarvjeet kaur asked 3 days ago
I am trying to connect with UK govt website using these url 
https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles https://uat.driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicle

while connecting with these api's.I am getting error. 

The Error is 
'The SSL connection could not be established.

This is my code  public async Task<string> GetDataWithRestsharp()
{
string url = "https://driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1/vehicles"; string apiKey = mywebapikey string registrationNumber = "HN17WZX"; var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
var client = new RestClient(handler);
var request = new RestRequest(url, Method.Post);
request.AddHeader("x-api-key", apiKey);
request.AddHeader("Content-Type", "application/json"); var body = new
{
registrationNumber = registrationNumber
};
request.AddJsonBody(body);
var response = await client.ExecuteAsync(request);
if (response.IsSuccessful)
{
Console.WriteLine("Response Content:");
Console.WriteLine(response.Content);
}
else
{
Console.WriteLine($"Error: {response.StatusCode} - {response.StatusDescription}");
Console.WriteLine("Response Content:");
Console.WriteLine(response.Content);
}
return response.Content;
}
2 Answers
Bobby Clapp answered 2 days ago
We aren't going to be able to help with issues with another's API. Seems you may need this: Please direct any technical support queries to [email protected] and include VES API technical query in the subject line.
Rob LeVineRob LeVine answered 2 days ago
In the past when I've had API issues (though not specifically the error you're getting), I've switched to the CURL alternative that the company offers so you might want to check that out.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right