AnsweredAssumed Answered

GetEndpointData string in wrong format in SSLLabsApiWrapper

Question asked by Tihomir Metodiev on May 15, 2018
Latest reply on May 22, 2018 by Sam Friday

Hello Experts,

I am really sorry for posting a silly question once again but please assist me with this one.


I am doing a C# implementation of the SSL Labs Api and you can see my code below. When the Analyze() output resolves successfully the hostname provided I use the GetEndpointData() function to get the information from the analysis. However the string variable is noted to be in wrong format.

Unhandled Exception: System.FormatException: Input string was not in a correct format. at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.IO.TextWriter.WriteLine(String format, Object arg0) at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object arg0) at System.Console.WriteLine(String format, Object arg0) at SSLExpirationStd.Program.Main(String[] args) in C:\Users\tihomir.metodiev\source\repos\SSLExpirationStd\SSLExpirationStd\Program.cs:line 102

I have tested the request with Postman Software and it works fine - ""


var hostname = ""
ssllService = new SSLLabsApiService("");
var sslAnalyze = ssllService.Analyze(hostname, SSLLabsApiService.Publish.Off, SSLLabsApiService.StartNew.On, SSLLabsApiService.FromCache.Off, 24, SSLLabsApiService.All.Done, SSLLabsApiService.IgnoreMismatch.On);
var sslAnalyzeStr = JsonConvert.SerializeObject(sslAnalyze, Formatting.Indented);


while (sslAnalyzeStr.Contains("statusMessage\": \"Resolving domain names"))
    sslAnalyzeStr = JsonConvert.SerializeObject(ssllService.Analyze(hostname, SSLLabsApiService.Publish.Off, SSLLabsApiService.StartNew.Ignore, SSLLabsApiService.FromCache.Off, 24, SSLLabsApiService.All.Done, SSLLabsApiService.IgnoreMismatch.On), Formatting.Indented);




string[] lines = sslAnalyzeStr.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
List<string> hostnameIPs = new List<string>();


for (int line = 1; line < lines.Length; line++)
    if (lines[line].IndexOf("ipAddress") != -1)


string IIPP = hostnameIPs[0];
Console.WriteLine(JsonConvert.SerializeObject(ssllService.GetEndpointData(hostname, IIPP,SSLLabsApiService.FromCache.On)), Formatting.Indented);

I will really appreciate any help provided.


Have a great day!