client.ListLicenseesAsync()
List
Returns a key's licensees, oldest first, up to 100 per request. The list omits cancelled licensees. The key must be enabled for sublicensing.
Endpoint
GET /keys/{key}/licensees
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<LicenseesResponse> ListLicenseesAsync(string key, ListLicenseesParams? query = null, CancellationToken cancellationToken = default)
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
key | string | yes | API Key |
query | ListLicenseesParams | no | Query parameters. Fields under Query Parameters. |
cancellationToken | CancellationToken | no | Cancels 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.
| Name | Type | Required | Description |
|---|---|---|---|
starting_after | string | no | ID of the licensee after which to list results. Pass the id of the last licensee on the previous page. |
limit | int | no | Limit |
query | string | no | Filter results by licensee name. Can be shortened to q= |
Response
LicenseesResponse. 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
using IdealPostcodes;
using var client = new IdealPostcodesClient("ak_test", "uk_test");
var response = await client.ListLicenseesAsync("ak_test", new ListLicenseesParams { Limit = 10 });
foreach (var licensee in response.Result.Licensees)
{
Console.WriteLine($"{licensee.Id}: {licensee.Name} ({licensee.Key})");
}
Console.WriteLine($"More pages: {response.Result.HasMore}");