Xolphin API wrapper for .NET

XolphinApiDotNet is a client library targeting .NET 4.5 and above that provides an easy way to interact with the Xolphin REST API.

Library installation

There are 2 ways to use XolphinApiDotNet:

  • Install-package XolphinApiDotNet (via Nuget)
  • Download source and compile

Usage

Client initialization

var client = new Client("<username>", "<password>");

Calling conventions

Most of the Requests classes have ability to assign the additional parameters of the request with 2 ways:

var reissue = new XolphinApiDotNet.Requests.Reissue(<csr_string>, DCVType.Email);
// 1. Fluent style
reissue.SetApproverEmail("email@example.com");
// 2. Property assignment
reissue.ApproverEmail = "email@example.com";

Request operations

Getting list of requests

// GET /requests
var requests = client.Request.All();
foreach (var request in requests)
{
    Console.WriteLine(request.Id);
}

Order certificate

// POST /requests
var products = client.Support.Products();
if (products.Any())
{
    var productId = products.First().Id;
    // request certificate for 1 year
    var requestsRequest = new XolphinApiDotNet.Requests.Request(productId, 1, <csr_string>, DCVType.Email)
        .SetApproverFirstName("<first_name>")
        .SetApproverLastName("<last_name>")
        .SetApproverPhone("+12345678901")
        .SetZipcode("123456")
        .SetŠ”ity("<city>")
        .SetCompany("<company>")
        .SetApproverEmail("<email>")
        .AddSubjectAlternativeName("test1.example.com")
        .AddSubjectAlternativeName("test2.example.com")
        .AddSubjectAlternativeName("test3.example.com")
        .AddDcv(new RequestDCV("test1.example.com", DCVType.Email, "email1@example.com"))
        .AddDcv(new RequestDCV("test2.example.com", DCVType.Email, "email2@example.com"));

    var responsesRequest = client.Request.Send(requestsRequest);
    Console.WriteLine(responsesRequest.Id);
}

Getting single request

// GET /requests/{id}
var responseRequest = client.Request.Get(960000002);
Console.WriteLine(responseRequest.Id);

Upload new request document

// POST /requests/{id}/upload-document
var uploadResponse = client.Request.Upload(960000002, new UploadDocument("<file_name>", File.ReadAllBytes("document.pdf")).SetDescription("<description>"));
Console.WriteLine(uploadResponse.Message);

Retry DCV

// POST /requests/{id}/retry-dcv
var retryDcvResponse = client.Request.RetryDCV(960000002, new DCV("test.example.com", DCVType.Email, "email@example.com"));
Console.WriteLine(retryDcvResponse.Message);

Send Subscriber Agreement

// POST /requests/{id}/sa
var subscribe = client.Request.Subscribe(960000002, "email@example.com");
Console.WriteLine(subscribe.Message);

Schedule validation call

// POST /requests/{id}/schedule-validation-call
var scheduleValidationCallResponse = client.Request.ScheduleValidationCall(960000002, DateTime.Now);
Console.WriteLine(scheduleValidationCallResponse.Message);

Certificate operations

Getting list of certificates

// GET /certificates
var certificates = client.Certificate.All();
foreach (var certificate in certificates)
{
    Console.WriteLine(certificate.Id);
}

Getting single certificate

// GET /certificates/{id}
var certificate = client.Certificate.Get(960000002);
Console.WriteLine(certificate.Id);

Download certificate

// GET /certificates/{id}/download
var downloadResult = client.Certificate.Download(960000002);

Reissue certificate

// POST /certificates/{id}/reissue
var reissue = new XolphinApiDotNet.Requests.Reissue(<csr_string>, DCVType.Email);
var responsesRequest = client.Certificate.Reissue(960000002, reissue);
Console.WriteLine(responsesReissue.Id);

Renew certificate

// POST /certificates/{id}/renew
var products = client.Support.Products();
var productId = products.First().Id;
// renew certificate for 1 year
var renew = new XolphinApiDotNet.Requests.Renew(productId, 1, <csr_string>, DCVType.Email);
var responsesRequest = client.Certificate.Renew(960000002, renew);
Console.WriteLine(responsesRequest.Id);

Cancel certificate

// POST /certificates/{id}/cancel
var cancelSettings = new XolphinApiDotNet.Requests.CancelSettings("cancellation reason");
var responsesBase = client.Certificate.Cancel(960000002, cancelSettings);

Supporting operations

Getting list of approver e-mail addresses

// GET /approver-email-addresses
var emailAddresses = client.Support.ApproverEmailAddresses("example.com");
foreach (var emailAddress in emailAddresses)
{
    Console.WriteLine(emailAddress);
}

Decode CSR

// POST /decode-csr
var csr = client.Support.DecodeCSR(<csr_string>);
Console.WriteLine(csr.Type);

Getting list of products

// GET /products
var products = client.Support.Products();
foreach (var product in products)
{
    Console.WriteLine(product.Id);
}

Getting single product

// GET /products/{id}
var product = client.Support.Product(960000002);
Console.WriteLine(product.Name);
WHMCS

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

Get SSL Module