Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function retrieves the best domain to use for SSL for a service.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/SSL/gen_cn_name?domain=example.com&service=cpanel

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Retrieves the best domain to use for SSL for the cPanel service.
$SSL_get_cn_name = $cpanel->uapi(
    'SSL', 'get_cn_name',    array(
        'domain'          => 'example.com',
        'service'         => 'cpanel',
  )
);

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Retrieves the best domain to use for SSL for the cPanel service.
my $SSL_get_cn_name = $cpliveapi->uapi(
    'SSL', 'get_cn_name',    {
        'domain'          => 'example.com',
        'service'         => 'cpanel',
    }
);

Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Retrieves the best domain to use for SSL for the cPanel service. -->
[% data = execute( 'SSL', 'get_cn_name', { domain => 'example.com', service => 'cpanel'} ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username SSL get_cn_name domain=example.com service=cpanel

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
  "messages": null,
  "errors": null,
  "status": 1,
  "data": {
    "is_self_signed": 1,
    "is_wild_card": 0,
    "ssldomain": "hostname.example.com",
    "ssldomain_matches_cert": 1,
    "cert_valid_not_after": "1394288638",
    "cert_match_method": "hostname"
  }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain name.

A valid domain name.

example.com

 

servicestring

Required

The service's name.

  • cpanel
  • ftp
  • imap
  • pop3
  • smtp
cpanel
add_mail_subdomainstringAny additional subdomains that are associated with the certificate.A valid string.mail

Returns

ReturnTypeDescriptionPossible valuesExample
is_self_signedBooleanWhether the certificate is self-signed.
  • 1 — Self-signed.
  • 0 — Not self-signed.
1
is_wild_cardBooleanWhether the certificate is a wildcard certificate.
  • 1 — Wildcard.
  • 0 — Not a wildcard.
0
ssldomainstringThe best domain to use to access the service.
  • A valid domain.
  • A valid username.
  • An email address.
hostname.example.com
ssldomain_matches_certBooleanWhether the certificate also covers the mail service.
  • 1 — Mail service.
  • 0 — No mail service.
1
cert_valid_not_afterstringThe certificate's expiration date.A date in Unix time format.1394288638
cert_match_methodstringThe method that the system used to match the certificate with the mail service.A valid string.hostname