Xolphin API wrapper for Node.js

xolphin-api-js is a library which allows quick integration of the Xolphin REST API in Node.js to automated ordering, issuance and installation of SSL Certificates.

Library installation

Library can be installed via npm

npm install xolphin-api-js

And updated via

npm update xolphin-api-js

Usage

Client initialization

var xolphin = require('xolphin-api-js')

var client = new xolphin.Client('<username>', '<password>');

Requests

Getting list of requests

client.request.all(function(err, requests){
    requests.forEach(function(request){
        console.log(request.id, request._embedded.product.brand);
    });
});

Getting request by ID

client.request.get(960000002, function(err, request){
    console.log(err, request._embedded.product.id);
});

Request certificate

var ccr = client.request.create(24, 1, '<csr_string>', "EMAIL");
ccr.address = "Address";
ccr.approverFirstName = "FirstName";
ccr.approverLastName = "LastName";
ccr.approverPhone = "+12345678901";
ccr.approverEmail = "email@example.com";
ccr.zipcode = "123456";
ccr.city = "City";
ccr.company = "Company";
ccr.subjectAlternativeNames.push("test1.example.com");
ccr.subjectAlternativeNames.push("test2.example.com");
ccr.dcv.push({
    domain: "test1.example.com",
    dcvType: "EMAIL",
    approverEmail: "email1.example.com"
});

client.request.send(ccr, function(err, result) {
    console.log(err, result.id);
});

Certificate

Certificates list and expirations

client.certificate.all(function(err, certificates){
    certificates.forEach(function(certificate){
        console.log(certificate.id, '-', (new Date(certificate.dateExpired).getTime() <= (new Date()).getTime()) );
    });
});

Download certificate

var fs = require('fs');
client.certificate.download(960000002, 'CRT', function(err, certificate){
    fs.writeFileSync('cert.crt', certificate);
});

Support

Products list

client.support.products(function(err, products){
    products.forEach(function(product){
        console.log(product.id, product.brand);
    });
});

Decode CSR

client.support.decodeCSR('<csr_string>', function(err, data){
    console.log(data.type, data.size);
});
WHMCS

Easily order, manage and install SSL certificates directly on cPanel, DirectAdmin and Plesk

Get SSL Module