Skip to main content

$client->updateLicensee()

Update

Updates a licensee's address, postcode, allowed URLs and daily limit. Returns the updated licensee. The name is fixed at creation.

Endpoint​

POST /keys/{key}/licensees/{licensee}

See the API reference for this endpoint.

This operation needs a Management Key. Pass it as the second argument to IdealPostcodes::client(), which sends it in the Authorization header. See setup.

Signature​

public function updateLicensee(string $key, string $licensee, array $body): LicenseeResponse

Arguments​

NameTypeRequiredDescription
$keystringyesAPI Key
$licenseestringyesLicensee Key
$bodyarrayyesThe JSON request body. Keys under Request Body.

Query Parameters​

None.

Request Body​

Pass these as keys of $body.

NameTypeRequiredDescription
namestringnoLicensee individual or organisation name
addressstringnoLicensee's first, second and third line address as well as post town concatenated by commas
postcodestringnoLicensee's postcode
whiteliststring|list<string>noA list of allowed URLs. An empty list disables the check.
dailyarray<string, mixed>no

Response​

IdealPostcodes\Responses\LicenseeResponse. 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​

update-licensee.phpphp
<?php

declare(strict_types=1);

use IdealPostcodes\IdealPostcodes;

require 'vendor/autoload.php';

$client = IdealPostcodes::client('ak_test', 'uk_test');

$response = $client->updateLicensee('ak_test', '56a11209ebe230380bf104c3', [
'name' => 'Acme Limited',
]);

echo $response->result->name, PHP_EOL;