SIC Codes?
jholsgrove opened this issue · 3 comments
Hi - Good nuget package :)
Question more than anything... is their a way to retrieve SIC codes from performing searches on companies? I can't see a way to do it currently from my playing about or from any docs... apologies if I am being thick and missed it somewhere. Here is how I am currently getting stuff:
private async Task GetCompanyData()
{
var request = new SearchCompanyRequest()
{
Query = Search.SearchTerm,
StartIndex = 0,
ItemsPerPage = 50
};
var settings = new CompaniesHouseSettings(ApiKey);
using (var client = new CompaniesHouseClient(settings))
{
var result = await client.SearchCompanyAsync(request);
TotalResults = (int)result.Data.TotalResults;
foreach (var company in result.Data.Companies)
{
CompanyHouseApiResponse.Add(company);
}
}
}
I am then mapping the extra company details against a Company object but the SIC code list doesn't seem to be present? Appreciate any insight.
Hey @jholsgrove, after you've done a search, you'd have to go lookup the company directly based on their ID, that will bring you back the SIC codes.
using var client = new CompaniesHouseClient(settings);
var result = await client.SearchCompanyAsync(request);
foreach (var company in result.Data.Companies)
{
var result2 = await client.GetCompanyProfileAsync(company.CompanyNumber);
Console.WriteLine(string.join(", ", result2.Data.SicCodes));
}
A-ha! Many thankings to you indeed!
Closing this issue, if you've got any other questions feel free to raise them. Thanks.