We use the GP Practices postcode lookup API in an app we have built. It has been dormant for a couple of years and during the restart and testing I’ve noticed our GP search feature has broken due to the following API endpoint not existing anymore:
That seems to be the best replacement Kevin thanks!
Note about the service search api:
Mixture of query params and body params for POST requests (not sure this is best practice, and it feels slightly messy)
Slight issues in the format of the body params can give false “not found” errors for places that do exist (no actual validation of the request configuration) Example below:
The following request provides the subsequent error message:
POST /service-search/search-postcode-or-place/?search=LE169QL&api-version=2 HTTP/1.1
subscription-key:---
Content-Type: application/json; charset=utf-8
Host: api.nhs.uk
Connection: close
User-Agent: Paw/3.3.6 (Macintosh; OS X/12.1.0) GCDHTTPRequest
Content-Length: 63
{"latitude":"52.6336159190942","longitude":"-1.13346203516866"}
{
"optionalErrorName": "We can't find 'LE169QL'",
"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": "<h1>We can't find 'LE169QL'</h1><p>If the place you searched for is in England, you could:</p><ul><li>check your spelling and try again</li><li>try a different place name</li></ul>"
}
The error message is extremely misleading and it is very difficult to see what the actual issue with the request is. Removing the “latitude” and “longitude” parameters from this request makes it return a 200 response with correct data.
The documentation isn’t very informative about this and it caused me quite a few issues. The above example isn’t the exact use case that led me to encounter this problem, its just the clearest way to explain the issue.