Create SSL

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

NameMethodValueDescriptionRequired
actPOSTcreatesslCreates and SSl CertificateYes
countryPOSTtextThe country origin should be specified, 2 letter abbreviation e.g. US or INYes
statePOSTtextThe state of origin should be specifiedYes
localityPOSTtextSpecify the locality hereYes
organisationPOSTtextSpecify the organisation nameYes
comnamePOSTtextSpecify the company name or server nameYes
emailPOSTtextSpecify the email for SSLYes
keysizePOSTIntSpecify the RSA keysizeYes
orgunitPOSTtextSpecify the organisational unitNo

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"
}
Was this helpful to you?