cPanel API 2 Functions - SSLInfo::fetchinfo
The cPanel API 2 system is deprecated. We strongly recommend that you use UAPI instead of cPanel API 2.
Description
This function retrieves an SSL certificate, private key, related CA bundle, and other information for a specified domain.
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
For more information, read our Calls from the WHM API documentation.
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',
)
);
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.
# Retrieve certificate information for "example.com" domain
my $retrieve_sslinfo = $cpliveapi->api2(
'SSLInfo', 'fetchinfo',
{
'domain' => 'example.com',
}
);
For more information, read our Guide to the LiveAPI System.
cPanel Tag System (deprecated)
- cPanel tags are deprecated . We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI .
- cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
- For more information, read our Deprecated cPanel Tag Usage documentation.
Command Line
cpapi2 --user=username SSLInfo fetchinfo domain=example.com
- You must URI-encode values.
-
username
represents your account-level username. -
You
must
include the
--user=username
option. -
For more information and additional output options, read our
Guide to cPanel API 2
documentation or run the
cpapi2 --help
command. -
If you run CloudLinux™, you
must
use the full path of the
cpapi2
command:/usr/local/cpanel/bin/cpapi2
Output (JSON)
{
"cpanelresult": {
"apiversion": 2,
"func": "fetchinfo",
"data": [
{
"statusmsg": "ok",
"status": 1,
"ip": ".\n",
"key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA7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/Jxa0tvkCgYEAlOezbaxuL\/flRGDwJr5G\nBS3HZ6s5RLVDWkPlph1X7MggliEnNlZ+g9dgHbQ+n5SIKZsuylF43\/UerUsFSQJ4\n0TivSRd8PRkj5s2SpqfHQGaFrp2pcyBWgEU9cYzz7uDWHgSj2\/oM0SB65h0CHe0L\nq59\/fBWkY7bnEoN9HhcBN8ECgYEAxRWsXIK8fYzZO2VHRoabtff6CBcUMksqaFG0\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\nUzEoMCYGC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
"module": "SSLInfo"
}
}
Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
You must use either the domain
or the crtdata
parameter.
Parameter | Type | Description | Possible Values | Example |
---|---|---|---|---|
domain |
string | The domain name. If you submit both the |
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 |
status |
Boolean | Whether the function succeeded. |
|
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 file in Base64 PEM format. |
|
cab |
string | The CA bundle's contents. | A valid CA bundle file in |
-----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-----
|
key |
string | The certificate's key file. | A valid key file in Base64 PEM format. |
-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA7jDRbXUxnPrV5IYI2oOB6+86PChpTBdjLZeC\/OaLxIs9cga0\nTznXBkUKal\/VOdP\/51uZkDTSZoVMNffKa7mqumGcoxyBmkOFAyRYK99WYIxyBKre\n3vCkwHxJL+3Y4Cchbfh4oC6KmctrFP\/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uDWHgSj2\/oM0SB65h0CHe0L\nq59\/fBWkY7bnEoN9HhcBN8ECgYEAxRWsXIK8fYzZO2VHRoabtff6CBcUMksqaFG0\nAeMOTcjaarz4ayZRhLRODRygW4m9N6JXxD76yglPL8i1DoRhsU8dto3DdS27otto\nWPl5Otdj+e35uw3LeV1bb\/Z7sd7HnD8FlM6XJIoSUum5pvtLN7\/bRzIJFz0HQmsW\njriZx3kCgYA\/bFaFWs8qRWD8UrZ+0HEaj4sfgIj16I5WJw8Zsec+h94nN9nf0ru8\nWjeVZ8aJDxeUFRbBFNIjsoddRa7gEO6lTJAFAxezws\/svHq8wFrS0lIUOuY5Phoj\nU7KxemjUAMXeIRo262zWbRuf7Or4MpGKOnnXgJqcCVvX9+XNd4eACQ==\n-----END RSA PRIVATE KEY-----
|
reason |
string |
A reason for failure. This function only returns a |
A string that describes the error. |
This is an error message. |
result |
Boolean | Whether the function succeeded. |
|
1 |