Irish Company search #API example in C#
Like the UK’s companies house, you can access basic information about Irish companies using an API that is free to use (mostly), and quite easy to implement.
I say mostly, because unlike the UK version, they charge €2.50 for document downloads.
Here’s the code example (without my credentials) in c#
var strUrl = “https://services.cro.ie/cws/companies?company_num=389820&htmlEnc=1”;
string userName = “** An email address **”;
string password = “**A GUID**”;
WebClient client = new WebClient();
string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + “:” + password));
client.Headers[HttpRequestHeader.Authorization] = string.Format(“Basic {0}”, credentials);
client.Headers[HttpRequestHeader.Accept] = “application/json”;
string strJson = “”;
try
{
strJson = client.DownloadString(strUrl);
}
catch (WebException exception)
{if (exception.Response != null)
{
var responseStream = exception.Response.GetResponseStream();if (responseStream != null)
{
using (var reader = new StreamReader(responseStream))
{
strJson = reader.ReadToEnd();
}
}
}
}Console.Write(strJson);