Knowledge base
Examples of API Oktawave method calls
Posted by Piotr Malendo on 25.04.2013 20:09

Below is an example of API method simple string calls leading to user authentication (eg. filling data in application form of partner login), shutting down all his machines, and then creating a new one.

The example is created based on the C #, the class of OktawaveXXXClient therein occurring are proxy classes generated by wsdl.exe tool (part of the Microsoft Visual Studio) for each web services included in the API Oktawave.

 

OktawaveCommonClient commonClient = new OktawaveCommonClient();

User user = commonClient.LogonUser(”user_test”, “secretPassword”);

if(user != null)

{

OktawaveClientsClient clientsClient = new OktawaveClientsClient();

 

clientsClient.Credentials.UserName.UserName = “user_test”;

clientsClient.Credentials.UserName.Password = “secretPassword”;

 

VirtualMachineSearchParams searchParams = new VirtualMachineSearchParams();

searchParams.ClientId = user.Client.ClientId; SearchResultsCollection<VirtualMachineView> machines =

clientsClient.GetVirtualMachines(searchParams);

 

foreach (VirtualMachineView vm in machines)

{

clientsClient.TurnoffVirtualMachine( vm.VirtualMachineId, user.Client.ClientId); clientsClient.CreateVirtualMachineWithSpecificDiskSize( selectedTemplateId, 20, null“new_virtual_machine”, selectedClass, null, selectedConnectionType, selectedPaymentMethod, user.Client.ClientId, null,Consts.DAL.TemplateType.Machine, nullnull);

}

}



Attachments 
 
 oktawaveapimethods.cs (0.95 KB)
(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.