Skip to main content

client.RetrieveConfig()

Retrieve

Returns a configuration by name. This request needs no user_token, so a browser integration can read its own configuration at runtime.

Endpoint​

GET /keys/{key}/configs/{config}

See the API reference for this endpoint.

Signature​

func (c *Client) RetrieveConfig(ctx context.Context, key string, config string) (*ConfigResponse, error)

Arguments​

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

Query Parameters​

None.

Response​

*idealpostcodes.ConfigResponse. 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-config/main.gogo
package main

import (
"context"
"fmt"
"log"

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

func main() {
client := idealpostcodes.NewClient("ak_test")
res, err := client.RetrieveConfig(context.Background(), "ak_test", "woocommerce")
if err != nil {
log.Fatal(err)
}
fmt.Println(res.Result.Payload)
}