Skip to main content

$client->listConfigs()

List

Returns every configuration stored against a key, oldest first.

Endpoint​

GET /keys/{key}/configs

See the API reference for this endpoint.

This operation needs a Management Key. Pass it as the second argument to IdealPostcodes::client(), which sends it in the Authorization header. See setup.

Signature​

public function listConfigs(string $key): ConfigsResponse

Arguments​

NameTypeRequiredDescription
$keystringyesAPI Key

Query Parameters​

None.

Response​

IdealPostcodes\Responses\ConfigsResponse. Read fields as properties, such as $response->result, or as an array with the API's field names. toArray() returns the decoded body.

Errors​

An HTTP error throws ApiException with the HTTP status, the API error code from getCode() and the decoded body. A transport failure throws TransporterException. See error handling.

Example​

list-configs.phpphp
<?php

declare(strict_types=1);

use IdealPostcodes\IdealPostcodes;

require 'vendor/autoload.php';

$client = IdealPostcodes::client('ak_test', 'uk_test');

$response = $client->listConfigs('ak_test');

foreach ($response->result->configs as $config) {
echo $config->name, ' updated ', $config->updatedAt, PHP_EOL;
}