Knowledge base
How to start using API?
Posted by on 02.07.2013 12:42

People starting their adventure with Oktawave API often ask us the following questions. Below you will find information that will help you to start your adventure with our API.

1. Where can I download the sample applications code that works with the Oktawave API?
To verify the operation of specific methods, the easiest way is to look up the sample application source code written in different languages. In the list below you will find examples of code for Python, PHP and Ruby.

  • Python. See CLI code written for Oktawave.
  • PHP. Download and check out these simple examples. Remember, to set variables private $ USER = 'USER_DO_API', and private $ PASSWORD = 'PASS' in OktawaveClient.php file, by typing your user name and password the same as the admin panel.
  • Ruby. See the plugin code for Chef (knife) which allows the integration of Oktawave infrastructure with chef.

 
2. How to use API to create a new OCI, while setting its class other than the default?
To create a new OCI using the API, you should take advantage of the CreateVirtualMachine. This function accepts a number of parameters, and one of them is selectedClass (Nullable <Int32>), which is just an instance class. Class can not be lower than the minimum template instance class. This parameter is optional and has a value according to the following list.

  •     34    (v1.standard-2.2)
  •     35    (v1.standard-4.4)
  •     36    (v1.standard-8.8)
  •     289    (v1.standard-1.09)
  •     1047    (v1.standard-1.05)
  •     1048    (v1.standard-16.160
  •     1049    (v1.highmemory-16.32)
  •     1050    (v1.highmemory-16.64)
  •     1263    (v1.highmemory-1.4)
  •     1264    (v1.highmemory-2.8)
  •     1265    (v1.highmemory-4.16)
  •     1266    (v1.highmemory-8.32)
  •     1267    (v1.highmemory-16.96)
  •     1268    (v1.highcpu-2.09)
  •     1269    (v1.highcpu-4.2)
  •     1270    (v1.highcpu-8.4)
  •     1271    (v1.highcpu-16.8)


 
3. How to check the instance class ID (type) and parameter identifiers of all the methods (dictionary parameters)?
Checking the class dictionary and method parameters can be performed using method GetDictionaryItems belonging to CommonService. The GetDictionaryItem method parameter is INT dictionaryID that for the class dictionary of instance is set to 12.

 
4. How to identify dictionary parameters of the method using a WSDL file, on the CloneVirtualMachine method example?

  • You must open the following address: https://api.oktawave.com/ClientsService.svc?wsdl.
  • Then we search for CloneVirtualMachine method. In parameters of the method we see: name = "cloneType" type = "Q60: Consts.DAL.CloneType".
  • cloneType is a parameter specifying the nature of your clone, there are two options here.
  • Runtime - clone is made with full initialization, with change of hostname, setting new administrator password, system activation (if Windows), etc.
  • AbsoluteCopy - clone is made without operations affecting the contents of the OCI. Only the IP address is changed in the DHCP (so that you can safely enable created OCI). All other parameters / settings / password / OCI contents remain the same as in OCI source.
  • So, calling the CloneVirtualMachine in CLoneType parameter should receive Runtime or AbsoluteCopy.



5. Is it posible to use API, with the so-called Private templates?
No, now the platform does not support natively private templates. However, you can use the cloning mechanism to create your own pseudo templates. To do this, prepare the OCI, which will act as a template, and then turn it off. ID of prepared OCI can be used in a CloneVirtualMachine method in virtualMachineId parameter.

 
6. How to check the ID (virtualMachineID) of specific OCI?
To do this, use the method GetVirtualMachines that accepts in the parameter: searchParams (VirtualMachineSearchParams), where you pass the ClientID that is a parameter that identifies the account. In response, we get a list of simplified OCI instance objects and each of them will be VirtualMachineId identifier. GetVirtualMachines method returns all instances of the OCI and applications. We can narrow down results by using the searchParams filter.


7. How do I find the password for the newly created OCI instance?
To get the access data to the newly created OCI, download entries from the event logs by using  GetVirtualMachineHistories method, giving value of 247 as ActionTypeFilter (VirtualMachineAccessData).

(1 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.