client.list_licensees
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 management_key: to IdealPostcodes::Client.new, which sends it in the Authorization header. See setup.
Signature
def list_licensees(key, starting_after: nil, limit: nil, query: nil)
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
key | String | yes | API Key |
keywords | keyword arguments | no | One per query parameter, named as the API names them. A keyword left out or nil is not sent. |
Query Parameters
Pass these as keyword 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 | Integer | no | Limit |
query | String | no | Filter results by licensee name. Can be shortened to q= |
Response
IdealPostcodes::Responses::LicenseesResponse. Read fields with readers named as the API names them, such as response.result, or with response["result"]. to_h returns the decoded body.
Errors
An HTTP error raises IdealPostcodes::ApiError with the HTTP status, the API error code and the decoded body. A transport failure raises IdealPostcodes::TransportError. See error handling.
Example
require "ideal_postcodes"
client = IdealPostcodes::Client.new(api_key: "ak_test", management_key: "uk_test")
response = client.list_licensees("ak_test", limit: 10)
response.result.licensees.each do |licensee|
puts "#{licensee.id}: #{licensee.name} (#{licensee.key})"
end
puts "More pages: #{response.result.has_more}"