This API Searches for Previous Names - Which is Really good, however it does not return the Previous Name it matched against - so you have to end up making an APOI call to every result in the list to get the Data by Company number - This is putting undue stress on the APIs - Is it possible to have the Previous Name tat it matched to returned in the data set.
Well … in fact, it does! It’s not as helpful as it could be (you’ll need to check what was matched yourself) but if you match on a previous name using Companies Search it seems the matched previous name is returned in the snippet
field.
Example (not the best one, which would be a firm that renamed to something very different) - search for “TWITTER UK” (I’ve removed some fields in the returned JSON and moved things about for clarity):
curl -u YOURAPIKEYHERE: "https://api.company-information.service.gov.uk/search/companies?q=TWITTER%20UK&items_per_page=2&start_index=0"
{
"start_index": 0,
"kind": "search#companies",
"total_results": 382805,
"page_number": 1,
"items_per_page": 2,
"items": [
{
"title": "TWITTER UK LTD",
"address_snippet": "Twitter Uk Ltd, 1st Floor, 20 Air Street, London, W1B 5AN",
"snippet": "TWITTER INFORMATION NETWORK LIMITED ",
"matches": {
"snippet": []
},
"description": "07653064 - Incorporated on 1 June 2011",
"company_number": "07653064",
...
},
...
]
}
Now try searching by a previous name, “TWITTER INFORMATION NETWORK”:
curl -u YOURAPIKEYHERE: "https://api.company-information.service.gov.uk/search/companies?q=TWITTER%20INFORMATION%20NETWORK&items_per_page=2&start_index=0"
{
"start_index": 0,
"total_results": 37618,
"kind": "search#companies",
"items_per_page": 2,
"page_number": 1,
"items": [
{
"title": "TWITTER UK LTD",
"address_snippet": "Twitter Uk Ltd, 1st Floor, 20 Air Street, London, W1B 5AN",
"snippet": "TWITTER INFORMATION NETWORK LIMITED ",
"matches": {
"snippet": []
},
"description": "07653064 - Incorporated on 1 June 2011"
"company_number": "07653064",
...
},
...
]
}
Not the best example as the snippet in the first search also lists the previous name as that matches the search (I think) - but if you find a company which has changed name to something completely different you’ll see the matching previous name in snippet when you search for that and match.
I am not sure why the matches.snippet
part (listing the parts of strings which matched) doesn’t appear to be doing anything (I’ve tried it on other things also)?
See this thread noting when this feature was introduced: