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.
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
Copyright Loopia AB 1999 - 2024
Loopia is part of team.blue
Loopia AB, Kopparbergsvägen 8, 722 13 Västerås
Org.nr: 556633-9304
Loopia’s services run on renewable energy