This API guide shows you how to install / Revoke / Renew an SSL certificate for your domain.
Use this API to install certificate on domain or multiple domains
Parameters
Sample code
curl --insecure -d "install_cert=1" -d "domain[]=doamin1" -d "domain[]=domain2" -u "Username:Password" -X POST "https://hostname or Server IP:2003/index.php?api=json&act=acme"
<?php
$user = 'Username';
$pass = 'Password';
$host = 'Hostname or Server IP';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2003/index.php?api=json&act=acme';
$post = array('install_cert' => '1',
'domain' => ['domain1','domain2']
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
if(!empty(curl_error($ch))){
echo curl_error($ch); die();
}
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']['msg']);
echo "</pre>";
}else{
print_r($res['error']);
}
?>
Revoke Certificate
Use this API to Revoke certificate on domain or multiple domains
Parameters
Sample code
curl --insecure -d "revoke_cert=1" -d "domain[]=doamin1" -d "domain[]=domain2" -u "Username:Password" -X POST "https://hostname or Server IP:2003/index.php?api=json&act=acme"
<?php
$user = 'Username';
$pass = 'Password';
$host = 'Hostname or Server IP';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2003/index.php?api=json&act=acme';
$post = array('revoke_cert' => '1',
'domain' => ['domain1','domain2']
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
if(!empty(curl_error($ch))){
echo curl_error($ch); die();
}
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']['msg']);
echo "</pre>";
}else{
print_r($res['error']);
}
?>
Renew Certificate
Use this API to Renew certificate on domain or multiple domains
Parameters
Sample Code
curl --insecure -d "renew_cert=1" -d "domain[]=doamin1" -d "domain[]=domain2" -u "Username:Password" -X POST "https://hostname or Server IP:2003/index.php?api=json&act=acme"
<?php
$user = 'Username';
$pass = 'Password';
$host = 'Hostname or Server IP';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2003/index.php?api=json&act=acme';
$post = array('renew_cert' => '1',
'domain' => ['domain1','domain2']
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
if(!empty(curl_error($ch))){
echo curl_error($ch); die();
}
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']['msg']);
echo "</pre>";
}else{
print_r($res['error']);
}
?>