Hello, I am new to the use of API, I am writing a program to check the name eligibility for someone who wants to open a company. I search for a word using the advenced company search api and pull the results, but this api pulls other company information other than the company name. Can I edit the api so that I can only pull the variable containing the company name? Another question is that the api only pulls the data of 20 companies, how many data can I pull at most in a single request?
Are you aware of the Company Name Availability checker? This is not available via the API yet e.g. it’s a web page.
I’m not aware of anything which just returns only the company name. Just ignore / filter out the other information?
There are several ways of finding companies by name but I don’t think any of them are quite designed for your task. All the searches (Search Companies as well as Advanced Search) are - as far as I know - “fuzzy” in the sense that they try to match more widely e.g. they’re designed for the goal of “find things like this” not “find this thing only, and if this is not found return no results”. See e.g. this thread on the subject:
For obtaining more results Companies House uses a “paging” system - see e.g. the documentation for Companies Search. Very briefly:
- This is controlled by the parameters
start_index
anditems_per_page
. - If you specify one, specify both (not certain this is a requirement but it’s sensible…)
-
start_index
starts from zero. It should be a multiple ofitems_per_page
. So e.g. you could requeststart_index=0&items_per_page=20
for a page of 20 results, thenstart_index=20&items_per_page=20
for the next page of 20 etc. -
items_per_page
- set this greater than one to avoid a bug. If you set it too high Companies House will return a lesser number (I’m not sure what their maximum is any moretry e.g. 50 / 100 etc.) - Because Companies House don’t give you any guarantees (and the final page of the matched data may not contain exactly
items_per_page
items you may need to check / count how many results have been returned. - For some endpoints there is a field which tells you the total number of results in the set - however this doesn’t have the same name for all the paged endpoints. For Companies Search it is
total_results
, for Advanced Search it ishits
etc.
Finally - Companies House repeatedly say that their APIs are not designed for downloading all their data - if you try to request too many results by e.g. setting start_index
too high eventually they won’t give you any more. Also beware that your requests are rate-limited so don’t issue too many too quickly (search this forum if you need more info on that).
Far more information about paging (as well as some other things) on this thread (but hopefully you shouldn’t need it).