I have a query that Please let me know if this option is available or not in companies house the query is if there are specific start date and end date parameters that can be included in the API call in order to retrieve the specific range of data. Actually I’m trying to fetch company details within last 2-6 month data from the companies house and put it into a third party application named zoho crm. Please help me to come up with a solution for this.
Any help would be much appreciated.
Start = “2024-01-01”;
info "start > " + Start;
End = “2024-06-31”;
info "End > " + End;
url = “https://api.company-information.service.gov.uk/advanced-search/companies?size=100&start_index=1&company_status=active”;
api_key = “API key”;
headers = Map();
headers.put(“Authorization”,"Basic " + zoho.encryption.base64Encode(api_key + “:”));
response = getUrl(url,headers);
response_map = response.toMap();
if(response_map.containsKey(“items”))
{
companies = response_map.get(“items”);
for each company in companies
{
company_data = company.toMap();
info company_data;
created_time = company_data.getJSON(“date_of_creation”).toString(“yyyy-MM-dd”);
info "created_time >> " + created_time;
if(created_time.toTime(“yyyy-MM-dd”) >= Start.toTime(“yyyy-MM-dd”) && created_time.toTime(“yyyy-MM-dd”) <= End.toTime(“yyyy-MM-dd”))
{
info “Given Date is within the range”;
lead_data = Map();
lead_data.put(“Company”,company_data.get(“company_name”));
lead_data.put(“Last_Name”,company_data.get(“company_name”));
lead_data.put(“Company_Number”,company_data.get(“company_number”));
lead_data.put(“Lead_Source”,“CH”);
lead_data.put(“Registration_Date1”,company_data.get(“date_of_creation”));
lead_data.put(“Company_Status_CH”,company_data.get(“company_status”));
lead_data.put(“Company_Type_CH”,company_data.get(“company_type”));
if(company_data.containsKey(“registered_office_address”))
{
address = company_data.get(“registered_office_address”).toMap();
address_str = “”;
if(address.containsKey(“address_line_1”))
{
address_str = address.get(“address_line_1”);
}
if(address.containsKey(“locality”))
{
address_str = address_str + ", " + address.get(“locality”);
}
lead_data.put(“Street”,address_str);
if(address.containsKey(“postal_code”))
{
lead_data.put(“Zip_Code”,address.get(“postal_code”));
}
else
{
lead_data.put(“Zip_Code”,“N/A”);
}
}
else
{
lead_data.put(“Street”,“N/A”);
lead_data.put(“Zip_Code”,“N/A”);
}
if(company_data.containsKey(“sic_codes”))
{
sic_codes = company_data.get(“sic_codes”);
if(sic_codes.size() > 0)
{
lead_data.put(“SIC_Code_CH”,sic_codes.get(0).toString());
}
else
{
lead_data.put(“SIC_Code_CH”,“N/A”);
}
}
else
{
lead_data.put(“SIC_Code_CH”,“N/A”);
}
createResponse = zoho.crm.createRecord(“Leads”,lead_data,{“trigger”:{“workflow”}});
if(createResponse.get(“status”) == “success”)
{
info “Lead created successfully”;
}
else
{
info “Failed to create lead”;
info "Detailed response: " + createResponse;
}
}
}
}
else
{
info “No companies found in the search results.”;
info response_map;
}
return “”;
See my response on your other query (which seems essentially a repeat of this one).
That is around 466,870 companies created between your Start Date of 2024-01-01 and End Date of 2024-06-30 including the 1,673 already dissolved.
Third party support may help you achieve your goal economically and in timely fashion. We hold all the data you are looking for and have previously provided various levels of support for the initial population of Zendesk, Hubspot and Salesforce CRM platforms.