Hello everyone,
We have a few questions regarding Service Search V3 (the new version).
We are currently using the Integration instance, but we have some issues with the endpoint POST /search-postcode-or-place.
According to the API documentation, a search by postcode would be possible, but every search we’ve attempting returns the following :
{
“optionalErrorName”: “We can’t find ‘BS23+1LA’”,
“optionalErrorText”: “If the place you searched for is in England, you could: check your spelling and try again or try a different place name.”,
“optionalErrorHTML”: “
We can’t find ‘BS23+1LA’
If the place you searched for is in England, you could:
- check your spelling and try again
- try a different place name
”
}
With a 500 error.
We are planning to user V3 when it’s available (with Welsh data), and i would like to confirm we can use this endpoint as we are using it in V2.
We use this endpoint to search for postcodes and get their longitude/latitude.
Also the API documentation is a bit unclear if that endpoint will be in OData format or not. Currently we’re using the filter “LocalType eq ‘Postcode’” and I would like to know if this would be still available.
Thanks a million any answers
Xavier
Hi Xavier,
As the Directory of Healthcare Services API - version 3 is still in development at the moment, it is a bit confusing. It appears that it is still using version 2 of the underlying API, so the query parameter ‘api-version’ needs to be set to ‘2’.
I have managed to get the following cURL request to work and return GPs near the postcode ‘BS23 1LA’.
cURL Command
curl --location 'https://int.api.service.nhs.uk/service-search-api/search-postcode-or-place?api-version=2&search=BS23%2B1LA' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_INTEGRATION_TEST_API_KEY_GOES_HERE' \
--data '{
"filter": "OrganisationTypeId eq '\''GPB'\''",
"select": "",
"top": 10,
"skip": 0,
"count": true
}'
… or …
curl -X POST 'https://int.api.service.nhs.uk/service-search-api/search-postcode-or-place?api-version=2&search=BS23+1LA' \
-H 'Content-Type: application/json' \
-H 'apikey: YOUR_INTEGRATION_TEST_API_KEY_GOES_HERE' \
-d '{
"filter": "OrganisationTypeId eq '\''GPB'\''",
"select": "",
"top": 10,
"skip": 0,
"count": true
}'
As far as I know, work is still being done on the new API, so things may change. I am a little confused myself regarding that API version number in the query parameter.
Thanks Adrian, that’s really helpful.