client.RetrieveLicensee()

Retrieve

Returns a licensee by its sl_ key. A cancelled or unknown licensee returns 404.

Endpoint​

GET /keys/{key}/licensees/{licensee}

See the API reference for this endpoint.

This operation needs a Management Key. Pass it with idealpostcodes.WithManagementKey(...) when you create the client, which sends it in the Authorization header. See setup.

Signature​

func (c *Client) RetrieveLicensee(ctx context.Context, key string, licensee string) (*LicenseeResponse, error)

Arguments​

NameTypeRequiredDescription
ctxcontext.ContextyesCancels the request and sets its deadline.
keystringyesAPI Key
licenseestringyesLicensee Key

Query Parameters​

None.

Response​

*idealpostcodes.LicenseeResponse. Fields the API may leave out or send as null are pointers. RawJSON() returns the body as received. See responses.

Errors​

An HTTP error returns *idealpostcodes.APIError with the HTTP status, the API error code and the body; match it with errors.AsType. A transport failure returns the net/http error, wrapped. See error handling.

Example​

retrieve-licensee/main.gogo
package main

import (
	"context"
	"fmt"
	"log"

	idealpostcodes "go.ideal-postcodes.co.uk/sdk"
)

func main() {
	client := idealpostcodes.NewClient("ak_test", idealpostcodes.WithManagementKey("uk_test"))
	res, err := client.RetrieveLicensee(context.Background(), "ak_test", "56a11209ebe230380bf104c3")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s: %s\n", res.Result.Name, res.Result.Key)
}