UAPI Functions - SSL::get_cn_name

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

 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',
  )
);

 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',
    }
);

 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 %]

 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.

 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 (Home >> Advanced >> API Shell) to directly test cPanel API calls.

 

Parameters

Parameter

Type

Description

Possible values

Example

domain

string

Required

The domain name.

 A valid domain name. 

 example.com 

 

service

string

Required

The service's name.

  • cpanel
  • ftp
  • imap
  • pop3
  • smtp

cpanel

 add_mail_subdomain 

 string 

 Any additional subdomains that are associated with the certificate. 

A valid string.

mail

 

Returns

Return

Type

Description

Possible values

Example

is_self_signed

Boolean

Whether the certificate is self-signed.

  • 1 — Self-signed.
  • 0 — Not self-signed. 

1

is_wild_card

Boolean

Whether the certificate is a wildcard certificate.

  • 1 — Wildcard.
  • 0 — Not a wildcard.

0

ssldomain

string

The best domain to use to access the service.

  • A valid domain.
  • A valid username.
  • An email address.

 hostname.example.com 

 ssldomain_matches_cert 

 Boolean 

Whether the certificate also covers the mail service.

  • 1 — Mail service.
  • 0 — No mail service. 

1

cert_valid_not_after

string

The certificate's expiration date.

A date in Unix time format.

1394288638

cert_match_method

string

 The method that the system used to match the certificate with the mail service. 

A valid string.

hostname

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....