For generating SSL Certificate for your domain you need to provide SSL Certificate Private Key (virtualizor.key) and Certificate Signing Request (virtualizor.csr) to your Certificate Provider. The Create SSL API allows you to create these files. The API response will contain "done" as "1" after these files are generated successfully.
For more information, you can refer this Adding SSL Certificate Guide.
HTTP Request
https://hostname:4085/index.php?act=createssl
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | POST | createssl | Creates and SSl Certificate | Yes |
country | POST | text | The country origin should be specified, 2 letter abbreviation e.g. US or IN | Yes |
state | POST | text | The state of origin should be specified | Yes |
locality | POST | text | Specify the locality here | Yes |
organisation | POST | text | Specify the organisation name | Yes |
comname | POST | text | Specify the company name or server name | Yes |
POST | text | Specify the email for SSL | Yes | |
keysize | POST | Int | Specify the RSA keysize | Yes |
orgunit | POST | text | Specify the organisational unit | No |
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['create'] = 1;
$post['country'] = 'IN';
$post['state'] = 'maharashtra';
$post['locality'] = 'mumbai';
$post['organisation'] = 'soft';
$post['orgunit'] = 'tech';
$post['comname'] = 'soft';
$post['email'] = 'apitest@apitest.com';
$post['keysize'] = 1024;
$output = $admin->createssl($post);
print_r(json_encode($output));
?>
Output
{
"title": "Create SSL Certificate",
"done": "1",
"timenow": "1478741589",
"time_taken": "0.078"
}