Child pages
  • WHM API 1 Functions - get_best_ssldomain_for_service
Skip to end of metadata
Go to start of metadata

Description

This function retrieves the most appropriate SSL-encrypted domain to use to access a service.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/get_best_ssldomain_for_service?api.version=1&service=whostmgr
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/get_best_ssldomain_for_service?api.version=1&service=whostmgr
 Command Line
whmapi1 get_best_ssldomain_for_service service=whostmgr


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{  
   "metadata":{  
      "result":1,
      "command":"get_best_ssldomain_for_service",
      "version":1,
      "reason":"OK"
   },
   "data":{  
      "is_currently_valid":0,
      "cert_valid_not_after":1457452989,
      "ssldomain_matches_cert":0,
      "ssldomain":"hostname.example.com",
      "is_wild_card":0,
      "is_self_signed":1,
      "cert_match_method":"none"
   }
}
 Output (XML)
<result>
    <metadata>
        <reason>OK</reason>
        <result>1</result>
        <version>1</version>
        <command>get_best_ssldomain_for_service</command>
    </metadata>
    <data>
        <ssldomain_matches_cert>0</ssldomain_matches_cert>
        <is_wild_card>0</is_wild_card>
        <ssldomain>hostname.example.com</ssldomain>
        <cert_match_method>none</cert_match_method>
        <cert_valid_not_after>1457452989</cert_valid_not_after>
        <is_currently_valid>0</is_currently_valid>
        <is_self_signed>1</is_self_signed>
    </data>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
servicestring

Required

The service's name.

A valid service name.whostmgr

Returns

ReturnTypeDescriptionPossible valuesExample
is_currently_validBoolean

Whether the certificate is currently valid.

Notes:

If the certificate is valid, the following statements are true:

  • The certificate is not self-signed (the is_self_signed value is 0).
  • The certificate matches the SSL domain (the ssldomain_matches_cert value is 1).
  • The certificate is within its validity period (the cert_valid_not_after value is less than the current time and date).


  • 1 — The certificate is valid.
  • 0 — The certificate is not valid.
0
cert_valid_not_afterstringThe expiration date of the certificate.A date in Unix time format.1457452989
ssldomain_matches_certBooleanWhether an SSL-encrypted domain matches the certificate.
  • 1 — Matches.
  • 0 — Does not match.
0
ssldomainstringThe domain of the service's SSL certificate.A valid domain name.hostname.example.com
is_wild_cardBooleanWhether the service uses a wildcard certificate.
  • 1 — The service uses a wildcard certificate.
  • 0 — The service does not use a wildcard certificate.
0
is_self_signedBoolean

 Whether the certificate is self-signed.

Note:

For legacy reasons, if the ssldomain_matches_cert value is 0, then the function will always return a value of 1 for the is_self_signed return, regardless of whether the certificate is actually self-signed.
  • 1 — The certificate is self-signed.
  • 0 — The certificate is not self-signed.
1
cert_match_methodstringThe method that the system used to match the domain with the certificate.
  • none — No domain matches the certificate.
  • exact — The domain exactly matches the certificate.
  • exact-wildcard — The domain exactly matches the domain of a wildcard certificate.
  • mail-wildcard — The mail subdomain of the domain matches the domain of the wildcard certificate.
  • www-wildcard — The www subdomain of the domain matches the domain of the wildcard certificate.
  • hostname-wildcard — The hostname's domain matches the domain of the wildcard certificate.
  • hostname — The hostname matches the domain of the certificate.
  • localdomain_on_cert-mail-wildcard — Any mail subdomain of any domain on the server matches the certificate.
  • localdomain_on_cert-www-wildcard — Any www subdomain of any domain on the server matches the certificate.
  • localdomain_on_cert — Any domain on the server matches the certificate.
none