cPanel API 2 Functions - SSLInfo::fetchinfo

Description

This function retrieves an SSL certificate, private key, related CA bundle, and other information for a specified domain.

Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.

 

Examples 


 WHM API (JSON)

https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=SSLInfo&cpanel_jsonapi_func=fetchinfo&domain=example.com

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Retrieve certificate information for "example.com" domain
$retrieve_sslinfo $cpanel->api2(
    'SSLInfo''fetchinfo',
    array(
        'domain' => 'example.com',
    )
);

 
 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
#  Retrieve certificate information for "example.com" domain
my $retrieve_sslinfo $cpliveapi->api2(
    'SSLInfo''fetchinfo',
   {
      'domain' => 'example.com',
    }
);

 

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use theLiveAPI system to call the cPanel APIs.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read ourDeprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.

 

 Output (JSON)

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "fetchinfo",
    "data": [
      {
        "statusmsg": "ok",
        "status": 1,
        "ip": ".\n",
        "key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA7jDRbXUxnPrV5IYI2oOB6+86PChpTBdjLZeC\/OaLxIs9cga0\nTznXBkUKal\/VOdP\/51uZkDTSZoVMNffKa7mqumGcoxyBmkOFAyRYK99WYIxyBKre\n3vCkwHxJL+3Y4Cchbfh4oC6KmctrFP\/xSuQ+F8R5XG7RXCETtJ1HbaOmwceCQW7G\no318wNBHCvXKaJa\/QjsH8cHeGM9eSVuJpEx1FdLQzl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CBcUMksqaFG0\nAeMOTcjaarz4ayZRhLRODRygW4m9N6JXxD76yglPL8i1DoRhsU8dto3DdS27otto\nWPl5Otdj+e35uw3LeV1bb\/Z7sd7HnD8FlM6XJIoSUum5pvtLN7\/bRzIJFz0HQmsW\njriZx3kCgYA\/bFaFWs8qRWD8UrZ+0HEaj4sfgIj16I5WJw8Zsec+h94nN9nf0ru8\nWjeVZ8aJDxeUFRbBFNIjsoddRa7gEO6lTJAFAxezws\/svHq8wFrS0lIUOuY5Phoj\nU7KxemjUAMXeIRo262zWbRuf7Or4MpGKOnnXgJqcCVvX9+XNd4eACQ==\n-----END RSA PRIVATE KEY-----",
        "crt_origin": "example",
        "searched_users": [
          "example"
        ],
        "key_origin": "example",
        "domain": "example.com",
        "user": "example",
        "crt": "-----BEGIN CERTIFICATE-----\nMIIECzCCAvOgAwIBAgIFAcrSLckwDQYJKoZIhvcNAQEFBQAwgZ0xFDASBgNVBAMM\nC2V4YW1wbGUuY29tMRYwFAYDVQQLDA1Eb2N1bWVudGF0aW9uMQswCQYDVQQGEwJV\nUzEoMCYGCSqGSIb3DQEJARYZbGF1cmVuY2Uuc2ltb25AY3BhbmVsLm5ldDEUMBIG\nA1UECgwLY1BhbmVsIEluYy4xDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3Vz\ndG9uMB4XDTE0MDkxMTIxNDUxNFoXDTE1MDkxMTIxNDUxNFowgZ0xFDASBgNVBAMM\nC2V4YW1wbGUuY29tMRYwFAYDVQQLDA1Eb2N1bWVudGF0aW9uMQswCQYDVQQGEwJV\nUzEoMCYGCSqGSIb3DQEJARYZbGF1cmVuY2Uuc2ltb25AY3BhbmVsLm5ldDEUMBIG\nA1UECgwLY1BhbmVsIEluYy4xDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3Vz\ndG9uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7jDRbXUxnPrV5IYI\n2oOB6+86PChpTBdjLZeC\/OaLxIs9cga0TznXBkUKal\/VOdP\/51uZkDTSZoVMNffK\na7mqumGcoxyBmkOFAyRYK99WYIxyBKre3vCkwHxJL+3Y4Cchbfh4oC6KmctrFP\/x\nSuQ+F8R5XG7RXCETtJ1HbaOmwceCQW7Go318wNBHCvXKaJa\/QjsH8cHeGM9eSVuJ\npEx1FdLQzl4MMf4jEcEWFj2wCHByf18Qeel71mVNCRae67abD04g6l0Sn5lHgb9q\nutzWTQfNFRgL1yAGW7CWuJVefaFZRxiU0tWeeyGRnoY3pPLiZSmcR+W8ABR8xkkv\n+cYhDQIDAQABo1AwTjAdBgNVHQ4EFgQUA6gTJckN0Lah5W53Cna0oC\/kclUwHwYD\nVR0jBBgwFoAUA6gTJckN0Lah5W53Cna0oC\/kclUwDAYDVR0TBAUwAwEB\/zANBgkq\nhkiG9w0BAQUFAAOCAQEAek1JfiOK8lUOTJpl1SBOFlKaIXToS4pY\/4nC8bumJNTX\nJTYANbav+X6Z4i11BXMXilAejUr5VEZIBnIsKV3VjllkuDYhhs7abOC5SZy64Q6O\nqMQiTvJhipgCLj6\/khuQNrAKMAAZDtrI0+oeD8smkvFGg3zljrGidfOTxXAn6Us+\nsxBU9msYQImGHEP50wSflVxL9\/t5GaReniTS\/\/ApLiETEgpvi4Bj4FNT9UwxTbNB\ncd1aH6wm\/J\/e8FUvPIJ0DxSUu6CiYITteU2sHyPOrgJSzd19jEgX\/TX5KHBjcU5u\npDeVyq4NH7brrkgqvOcCyCCrhmeIeXhqVeY6FWFreA==\n-----END CERTIFICATE-----",
        "cab": ""
      }
    ],
    "event": {
      "result": 1
    },
    "module": "SSLInfo"
  }
}

 

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 

The domain name.

Note:

 If you submit both the domain and crtdata parameters the function will use only the domain parameter. 

A valid domain.

 example.com 

crtdata

string

The SSL certificate's text.

 Valid certificate data. 

 

 

Returns

Return

Type

Description

Possible Values

Example

domain

string

The domain name.

A valid domain.

example.com

 statusmsg 

string

The certificate's status.

  • ok — The request is successful.
  • An error message — The request failed.

ok

status

boolean

Whether the function was successful.

  • 1 — The request is successful.
  • 0 — The request is unsuccessful.

1

ip

string

The domain's IP address.

A valid IP address.

192.168.0.1

user

string

The domain's owner.

A valid user account.

example

crt

string

The SSL certificate's contents.

A valid SSL certificate.

 

cab

string

The CA bundle's contents.

A valid CA bundle.

 

key

string

The certificate's key file.

A valid key file.

 

reason

string

A reason for failure.

Note:

 This function only returns a reasonvalue if it failed. 

A string that describes the error.

This is an error message.

result

 boolean 

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.

1

 

  • 13 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....