API Description
Use the LetEncrypt Install Certificate API to install the certificate
issued by Let’s Encrypt.
Let's Encrypt is a free, automated, and open Certificate Authority (CA).
It will issue a free certificate for your domain name after domain
name verification and Virtualizor from version 2.8.8 onward has
integrated this feature.
The API response will contain "done" as the message "Configuration
saved successfully" after the certificate is installed successfully.
For more information, you can refer this Let's Encrypt Certificate Installation Guide.
HTTP Request
curl "https://hostname:4085/index.php?act=letsencrypt"
Parameters
Sample Code
<?php require_once('/usr/local/virtualizor/sdk/admin.php'); $key = 'your_api_key'; $pass = 'your_api_pass'; $ip = 'your_server_ip'; $admin = new Virtualizor_Admin_API($ip, $key, $pass); $post = array(); $post['opt'] = 'save_cfg'; $post['primary_domain'] = 'hostname'; $post['contact_email'] = 'test@test.com'; $post['key_size'] = 2048; $post['renew_days'] = 80; $post['staging'] = 0; $post['enable_force'] = 1; $post['ssl_type'] = 'letsencrypt';
$output = $admin->letsencrypt($post); print_r(json_encode($output)); ?>
Output
{ "title": "LetsEncrypt", "done": "Configuration saved successfully", "crt_config_options": { "crt_save_cfg_frm": { "inputs": { "primary_domain": { "type": "text", "value": "hostname" }, "contact_email": { "type": "text", "value": "test@test.com" }, "key_size": { "type": "select", "value": "2048" }, "renew_days": { "type": "text", "value": "80" }, "staging": { "type": "checkbox", "value": "0" }, "enable_force": { "type": "checkbox", "value": "1" } } } }, "crt_details": { "crt_domain": "", "crt_san": "", "crt_issuer": "", "crt_serialno": "", "crt_valid_from_time": "", "crt_valid_to_time": "", "next_renew": "", "crt_installed": "No" }, "actid": "3413", "logs": "null", "timenow": "1478743086", "time_taken": "1.608" }