Ruby
partner10.createKey()
# plug in xml-rpc client module
# prepare structures required to invoke KA API method
AuthInfo = Struct.new( "AuthInfo", :login, :password )
ServerAddress = Struct.new( "ServerAddress", :ips, :macs )
CreationParameters = Struct.new( "CreationParameters", :hwid )
# create xml-rpc client instance point to KA service
server = XMLRPC::Client.new2( 'https://ka.demo.plesk.com:7050/', nil, 900 )
begin
puts 'Performing Call'
# invoke KA api method partner10.createKey and pass required parameters
result = server.call( "partner10.createKey",
AuthInfo.new( "API_LOGIN", "API_PASSWORD" ),
ServerAddress.new( [ "192.168.0.0" ], [] ),
'CLIENT_ID',
'VIRTUOZZO_2X3X',
['2CPU_40VPS'],
CreationParameters.new( '2111.4355.5697.53D9.C5B3.766A.843A.1984' ),
[ 'VIRTUOZZO_TOOLS' ],
CreationParameters.new( '2111.4355.5697.53D9.C5B3.766A.843A.1984' ))
puts "Contents:"
result.each { | key, value | puts "#{key}: #{value}" }
# error handling section
rescue XMLRPC::FaultException => e
puts "Error:"
puts e.faultCode
puts e.faultString
end