update_ssl()

Update an SSL certificate.

All API functions SSL Protection

Signature

update_ssl(array $parameters): mixed

Parameters

Pass these parameters as KasRequestParams. Every request also requires kas_login, kas_auth_type, and kas_auth_data, as shown in SOAP with PHP.

Name Description Requirement
hostname The host name to update Required
ssl_certificate_is_active SSL is active: Y|N (optional; without this parameter the status is kept unless the key or certificate is deleted) Optional
ssl_certificate_sni_csr The SSL CSR Optional
ssl_certificate_sni_key The SSL key (optional; without this parameter the stored key is kept, an empty value deletes it) Optional
ssl_certificate_sni_crt The SSL certificate (optional; without this parameter the stored certificate is kept, an empty value deletes it) Optional
ssl_certificate_sni_bundle The bundle or intermediate certificate Optional
ssl_certificate_force_https Redirect HTTP requests to HTTPS with HTTP 301: Y|N Optional
ssl_certificate_hsts_max_age HTTP Strict Transport Security (HSTS) value in seconds, -1 disables it (optional; without this parameter the stored value is kept) Optional

PHP example

<?php

// $sessionToken is returned by KasAuth, see SOAP with PHP.
$parameters = [
    'hostname' => 'example.com',
    'ssl_certificate_is_active' => 'Y',
    'ssl_certificate_sni_key' => '-----BEGIN PRIVATE KEY-----MIIE...-----END PRIVATE KEY-----',
    'ssl_certificate_sni_crt' => '-----BEGIN CERTIFICATE-----MIIE...-----END CERTIFICATE-----',
];

try {
    $client = new SoapClient('https://kasapi.kasserver.com/soap/wsdl/KasApi.wsdl');
    $response = $client->KasApi(json_encode([
        'kas_login' => 'w0123456',
        'kas_auth_type' => 'session',
        'kas_auth_data' => $sessionToken,
        'kas_action' => 'update_ssl',
        'KasRequestParams' => $parameters,
    ]));
    print_r($response);
} catch (SoapFault $fault) {
    echo 'Error: ' . $fault->faultstring;
}

Responses and error codes

  • TRUE the action was carried out
  • missing_parameter a required parameter is missing
  • in_progress the KAS object is currently being processed
  • nothing_to_do nothing was changed
  • ssl_certificate_is_active_syntax_incorrect
  • ssl_certificate_sni_key_syntax_incorrect
  • ssl_certificate_sni_crt_syntax_incorrect
  • ssl_certificate_sni_crt_is_not_a_crt
  • ssl_certificate_hostname_not_in_crt
  • ssl_certificate_sni_csr_syntax_incorrect
  • ssl_certificate_sni_bundle_syntax_incorrect
  • ssl_certificate_sni_bundle_is_not_a_bundle
  • ssl_certificate_sni_chainfile_syntax_incorrect
  • ssl_certificate_sni_chainfile_is_not_a_chainfile
  • ssl_certificate_sni_key_is_not_a_key
  • ssl_certificate_hsts_max_age_syntax_incorrect
  • ssl_certificate_force_https_syntax_incorrect