Skip to main content

client.UpdateLicenseeAsync()

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 new IdealPostcodesClient(apiKey, managementKey), or set ManagementKey in the options; the client sends it in the Authorization header. See setup.

Signature​

Task<LicenseeResponse> UpdateLicenseeAsync(string key, string licensee, UpdateLicenseeBody body, CancellationToken cancellationToken = default)

Arguments​

NameTypeRequiredDescription
keystringyesAPI Key
licenseestringyesLicensee Key
bodyUpdateLicenseeBodyyesThe JSON request body. Fields under Request Body.
cancellationTokenCancellationTokennoCancels the request.

Query Parameters​

None.

Request Body​

Set these on the body argument. Each property is the name in PascalCase, such as PostTown for post_town; required fields are constructor arguments. A property left null is not sent.

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
whitelistIReadOnlyList<string>noA list of allowed URLs. An empty list disables the check.
dailyUpdateLicenseeDailyno

Response​

LicenseeResponse. 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​

update-licensee.cscsharp
using IdealPostcodes;

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

var response = await client.UpdateLicenseeAsync("ak_test", "56a11209ebe230380bf104c3", new UpdateLicenseeBody
{
Name = "Acme Limited",
});

Console.WriteLine(response.Result.Name);