If you search for a company number (using /search or /search/companies) but set items_per_page
to 1 the items field is blank.
Using curl:
curl -uAPIKEY: “https://api.companieshouse.gov.uk/search/companies?q=SC294759&items_per_page=1”
{ “items_per_page”:1, “page_number”:2, “items”:[], “kind”:“search#companies”, “start_index”:1, “total_results”:1 }
page_number
also incorrectly shows 2.
However if items_per_page is changed to 2 - it shows data (and page_number is correctly 1):
curl -uAPIKEY: “https://api.companieshouse.gov.uk/search?q=SC229764&items_per_page=2”
{“items”: [ {“company_number”:“SC229764”, “address”:{“locality”:“Perthshire”, “postal_code”:“PH2 8HR”, “address_line_1”:“King Street”, “premises”:“7 “, “address_line_2”:“Perth”}, “links”:{“self”:”/company/SC229764”},“kind”:“searchresults#company”, “date_of_creation”:“2002-03-28”, “description_identifier”:[“incorporated-on”],“description”:“SC229764 - Incorporated on 28 March 2002”,“address_snippet”:“7 King Street, Perth, Perthshire, PH2 8HR”,“title”:“KIRKLANDS BUSINESS SOLUTIONS LIMITED”,“company_type”:“ltd”,“company_status”:“active”}],“total_results”:1,“start_index”:0,“page_number”:1,“items_per_page”:2,“kind”:“search#all”}
Setting start_index to 0 won’t help:
curl -uAPIKEY: “https://api.companieshouse.gov.uk/search?q=SC229764&items_per_page=1&start_index=0”
{“items_per_page”:1, “total_results”:1, “items”:[], “start_index”:1,“page_number”:2, “kind”:“search#all”}
If you don’t specify items_per_page all works correctly as the defaults are applied e.g. items_per_page
=20
curl -uAPIKEY: “https://api.companieshouse.gov.uk/search?q=SC229764”
{“items_per_page”:20,“total_results”:1,“kind”:“search#all”,“start_index”:0,“page_number”:1,“items”:[
{“title”:“KIRKLANDS BUSINESS SOLUTIONS LIMITED”,“description_identifier”:[“incorporated-on”],“description”:“SC229764 - Incorporated on 28 March 2002”,“links”:{“self”:"/company/SC229764"},“address_snippet”:“7 King Street, Perth, Perthshire, PH2 8HR”,“kind”:“searchresults#company”,“company_type”:“ltd”,“company_status”:“active”,“address”:{“postal_code”:“PH2 8HR”,“premises”:"7 ",“locality”:“Perthshire”,“address_line_2”:“Perth”,“address_line_1”:“King Street”},“company_number”:“SC229764”,“date_of_creation”:“2002-03-28”}
]}
If you search on a name however, items_per_page can be 1:
curl -uAPIKEY: “https://api.companieshouse.gov.uk/search/companies?q=kirklands&items_per_page=1”
{“kind”:“search#companies”,“items”:[{“date_of_creation”:“2002-03-28”,“company_number”:“SC229764”,“address”:{“premises”:“7 “,“locality”:“Perthshire”,“postal_code”:“PH2 8HR”,“address_line_1”:“King Street”,“address_line_2”:“Perth”},“title”:“KIRKLANDS BUSINESS SOLUTIONS LIMITED”,“snippet”:””,“company_type”:“ltd”,“links”:{“self”:"/company/SC229764"},“description”:“SC229764 - Incorporated on 28 March 2002”,“company_status”:“active”,“matches”:{“snippet”:[],“title”:[1,9]},“address_snippet”:“7 King Street, Perth, Perthshire, PH2 8HR”,“kind”:“searchresults#company”,“description_identifier”:[“incorporated-on”]}],“start_index”:1,“page_number”:2,“total_results”:30,“items_per_page”:1}
…although page_number
is still 2.
Order of URL parameters or including start_index doesn’t seem to have any effect.
curl -uAPIKEY: “https://api.companieshouse.gov.uk/search?q=SC229764&items_per_page=1&start_index=1”
{“page_number”:2,“items_per_page”:1,“total_results”:1,“kind”:“search#all”,“start_index”:1,“items”:[]}