Skip to main content

client.FindPlaceAsync()

Find Place

Returns place suggestions for a query, ranked by relevance. Places cover countries, administrative areas, capitals and other administrative seats.

Implementing Place Autocomplete​

Retrieving a full place takes two requests:

  1. Fetch suggestions from /places
  2. Fetch the place using the id on a suggestion

A query returns at most 10 suggestions. An empty query returns an empty result set. Show users the descriptive_name. The API drops suggestions that share one, so each name in a response identifies a single place.

Rate Limiting and Cost​

The rate limit is 3,000 requests per 5 minutes.

/places does not decrement your lookup balance, but resolving a suggestion to a full place does. We rate limit and then suspend integrations that repeatedly call /places without resolving.

Endpoint​

GET /places

See the API reference for this endpoint.

Signature​

Task<PlaceResponse> FindPlaceAsync(FindPlaceParams? query = null, CancellationToken cancellationToken = default)

Arguments​

NameTypeRequiredDescription
queryFindPlaceParamsnoQuery parameters. Fields under Query Parameters.
cancellationTokenCancellationTokennoCancels the request.

Query Parameters​

Set these on the query argument. Each property is the name in PascalCase, such as PostTown for post_town; required fields are constructor arguments.

NameTypeRequiredDescription
querystringnoSpecifies the place to query. Can be shortened to q=
country_isostringnoFilter by Country
bias_country_isostringnoBias by Country Bias by country ISO code. Uses 3 letter country code (ISO 3166-1) standard. Bias by multiple countries with a comma separated list. E.g. GBR,IRL
bias_lonlatstringnoBias by Geolocation
bias_ipstringnoBias by Geolocation of IP

Response​

PlaceResponse. Fields are properties in PascalCase, such as response.Result; fields this SDK version does not know are kept in AdditionalProperties. See responses.

Errors​

An HTTP error throws ApiException with the StatusCode, the API error Code and the raw Body. A success response whose body cannot be read throws UnserializableResponseException. Network failures and cancellation throw HttpClient's own HttpRequestException and OperationCanceledException. See error handling.

Example​

find-place.cscsharp
using IdealPostcodes;

using var client = new IdealPostcodesClient("ak_test");

var response = await client.FindPlaceAsync(new FindPlaceParams { Query = "Strumpshaw", CountryIso = "GBR" });

foreach (var place in response.Result.Hits)
{
Console.WriteLine($"{place.Id}: {place.DescriptiveName}");
}