Difference between revisions of "How to use the Cloud Ikoula private API"
Line 1: | Line 1: | ||
− | |||
− | This article has been created by an automatic translation software. You can view the article source [[:fr:Comment utiliser l'API Cloud Privé d’Ikoula|here]].<br /> | + | This article has been created by an automatic translation software. You can view the article source [[:fr:Comment utiliser l'API Cloud Privé d’Ikoula|here]].<br /><span data-translate="fr"></span> |
Line 26: | Line 25: | ||
* Your API key | * Your API key | ||
* Your secret key | * Your secret key | ||
− | * Send queries on "https://cloudstack.ikoula.com/client/api" with a method of | + | * Send queries on "https://cloudstack.ikoula.com/client/api" with a method of HTTP |
* Treat the return XML or JSON (choice ) | * Treat the return XML or JSON (choice ) | ||
Line 40: | Line 39: | ||
# &zoneId =4 | # &zoneId =4 | ||
# &apiKey =miVr 6X7u6bN_EJTVwZ 0nUkkJbPmY 3y2bciKwFQ | # &apiKey =miVr 6X7u6bN_EJTVwZ 0nUkkJbPmY 3y2bciKwFQ | ||
− | # &signature =LXX | + | # &signature =LXX 1DM 40AjcXU %2FcaiK 8RAP 0O1hU %3D |
<!--T:9--> | <!--T:9--> | ||
− | The line 1 corresponds to the point of entry (the link to the API b. <span class="notranslate">Cloud</span> | + | The line 1 corresponds to the point of entry (the link to the API b. <span class="notranslate">Cloud</span> Ikoula private ) |
The line 2 correspond a la command e a envoyer, ici on veut crée une nouvelle VM | The line 2 correspond a la command e a envoyer, ici on veut crée une nouvelle VM | ||
The line 3-6 correspondent aux différents paramètres de la command e. | The line 3-6 correspondent aux différents paramètres de la command e. | ||
Line 57: | Line 56: | ||
<!--T:12--> | <!--T:12--> | ||
− | To sort alphabetically sent fields. Attention to the settings one after the other separated by a & ( | + | To sort alphabetically sent fields. Attention to the settings one after the other separated by a & (Ampersand )and the string to lowercase. |
<!--T:13--> | <!--T:13--> | ||
Line 85: | Line 84: | ||
[[Category:cloudstack]] | [[Category:cloudstack]] | ||
− | + | <comments /> |
Revision as of 15:41, 23 September 2015
This article has been created by an automatic translation software. You can view the article source here.
When you register for the service b. Cloud Private Ikoula, you received an email with an API key and a secret key.
This information will allow you to connect to the API b. Cloud Private Ikoula.
URL API : https://cloudstack.ikoula.com/client/api
The domain administrator and user API specifications are respectively :
Admin : http://cloudstack.apache.org/docs/api/apidocs-4.2/TOC_Domain_Admin.html User : http://cloudstack.apache.org/docs/api/apidocs-4.2/TOC_User.html
The use of the API, to :
- Your API key
- Your secret key
- Send queries on "https://cloudstack.ikoula.com/client/api" with a method of HTTP
- Treat the return XML or JSON (choice )
Example of a query has the API using the GET method :
- https://cloudstack.ikoula.com/client/api/
- ?command =deployVirtualMachine
- &serviceOfferingId =1
- &diskOfferingId =1
- &templateId =2
- &zoneId =4
- &apiKey =miVr 6X7u6bN_EJTVwZ 0nUkkJbPmY 3y2bciKwFQ
- &signature =LXX 1DM 40AjcXU %2FcaiK 8RAP 0O1hU %3D
The line 1 corresponds to the point of entry (the link to the API b. Cloud Ikoula private ) The line 2 correspond a la command e a envoyer, ici on veut crée une nouvelle VM The line 3-6 correspondent aux différents paramètres de la command e. You can add the fields "response" which defined the return with the parameter format (XML /JSON ) The line 7 contains your API key (Here is an invalid example key, replace with your ) The line 8 est la signature générée à partir de la command e et de votre clé secrète
How to generate signature ?
We must ensure that all spaces are replaced by "%20" instead of "+"
To sort alphabetically sent fields. Attention to the settings one after the other separated by a & (Ampersand )and the string to lowercase.
Example of string parameters : apikey =mivr 6x7u6bn_ejtvwz 0nukkjbpmy 3y2bcikwfq &command =listvirtualmachines &Networkid =5
Finally apply a hmac_SHA 1 sur la chaîne générée avec comme clé de hashage votre clé secréte. Pour envoyer la requête il vous suffit de rajouter le champs signature avec la signature générée
$args is an associative array of all the arguments
// classement par clef ksort($args); $query = http_build_query($args); // sécurité pour l'encodage des espaces $query = str_replace("+", "%20", $query); // minuscule strtolower($query) // calcul du hash $hash = hash_hmac("SHA1", $query, $secretKey, true); // encodage en base 64 $signature = base64_encode($hash); ?>
Enable comment auto-refresher