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;
}
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 dvlaapiaccess@dvla.gov.uk and include VES API technical query in the subject line.
Please login or Register to submit your answer