Login

Create account and register the domain

This example shows how a reseller via Ruby connects to our XML-RPC server, creates a hosting account and registers a domain name.

Note that the following code example contains no error handling for the sake of readability.

Example

Below you find the code for the example above.


#!/usr/local/bin/ruby

require 'xmlrpc/client'
require 'pp'
require 'time'

global_username = 'user'
global_password = 'pass'
global_domain_server_url = "https://api.loopia.se/RPCSERV"

domain = "anders-via-ruby-" + Time.now.to_i.to_s + ".se"

contact = {'firstname' => 'Anders',
        'lastname' => 'Andersson',
        'company' => 'Loopia AB',
        'street' => 'Kopparlundsvägen 7B',
        'street2' => '',
        'zip' => '72130',
        'city' => 'Västerås',
        'country_iso2' => 'se',
        'orgno' => '556633-9304',
        'phone' => '021-128222',
        'cell' => '',
        'fax' => '',
        'email' => 'info@loopia.se'}

client = XMLRPC::Client.new2(global_domain_server_url)

response = client.call(
    "createNewAccount",
    global_username,
	global_password,
    domain,
    contact,
    false,
    false,
    true,
	"HOSTING_UNIX",
    "HOSTING_BUSINESS",
    true)
pp "Account created: " + response


Hey, do you need assistance?

Weekdays: 8AM - 7PM Weekends: 11 AM - 3 PM