Skip to main content

client.update_config

Update

Replaces a configuration's payload and returns the updated configuration. The name is fixed at creation.

Endpoint​

POST /keys/{key}/configs/{config}

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 update_config(key, config, payload: nil)

Arguments​

NameTypeRequiredDescription
keyStringyesAPI Key
configStringyesConfiguration Name
keywordskeyword argumentsnoOne per body field, named as the API names them. A keyword left out or nil is not sent.

Query Parameters​

None.

Request Body​

Pass these as keyword arguments too; the SDK sends them as the JSON body.

NameTypeRequiredDescription
payloadStringnoA serialised payload of up to 65536 characters

Response​

IdealPostcodes::Responses::ConfigResponse. 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​

update-config.rbruby
require "ideal_postcodes"

client = IdealPostcodes::Client.new(api_key: "ak_test", management_key: "uk_test")

payload = JSON.generate(removeOrganisation: true)
response = client.update_config("ak_test", "woocommerce", payload: payload)

puts "#{response.result.name} updated #{response.result.updated_at}"