$client->resolvePlace()
Resolve Place
Returns the full place for a place ID taken from a /places suggestion.
On top of the fields carried by the suggestion, the response adds coordinates, language and the underlying dataset record.
Each request decrements your lookup balance. An unknown ID returns 404.
Endpoint
GET /places/{place}
See the API reference for this endpoint.
Signature
public function resolvePlace(string $place, array $params = []): ResolvePlaceResponse
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
$place | string | yes | ID of place suggestion |
$params | array | no | Query parameters. Keys under Query Parameters. |
Query Parameters
Pass these as keys of $params.
| Name | Type | Required | Description |
|---|---|---|---|
tags | string|list<string> | no | Tags |
Response
IdealPostcodes\Responses\ResolvePlaceResponse. Read fields as properties, such as $response->result, or as an array with the API's field names. toArray() returns the decoded body.
Errors
An HTTP error throws ApiException with the HTTP status, the API error code from getCode() and the decoded body. A transport failure throws TransporterException. See error handling.
Example
resolve-place.phpphp
<?php
declare(strict_types=1);
use IdealPostcodes\IdealPostcodes;
require 'vendor/autoload.php';
$client = IdealPostcodes::client('ak_test');
$response = $client->resolvePlace('geonames_7296662');
$place = $response->result;
echo $place->descriptiveName, ' (', $place->countryIso, ')', PHP_EOL;
echo $place->latitude, ', ', $place->longitude, PHP_EOL;