Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Is there any way to use cloud stack API along with java / python?

In the clouds stack documents they only provided the information about the interface of the API. how to use those API along with programming language?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

CloudStack API’s can be accessed using

Using Command Line Interface (CLI) CloudMonkey - https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html

Using Https Requests - http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.0-incubating/html-single/API_Developers_Guide/

Using CloudStack Clients - https://github.com/jasonhancock/cloudstack-python-client

We can make two types of Http requests

  1. Unauthenticated API Requests using port 8096 (open port 8096 using management UI)
  2. Authenticated API Requests using signature

Sample Python code to create Signature

import urllib2
import urllib // to make the url request 
import hashlib              //encode it to http
import hmac
import base64      //encording 

request={}
request['command']='listUsers'
request['response']='xml'
request['apikey']='zdfhgsdhfgseahyg'
secretkey='ghfgfgfg'

>>> request
{'apikey': 'plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg', 'command': 'listUsers', 'response': 'json'}

>>>request_url="&".join(["=".join([r,urllib.quote_plus(request[r])]) for r in request.keys()])

>>>sig_url="&".join(["=".join([r.lower(),urllib.quote_plus(request[r]).lower()]) for r in sorted(request.iterkeys())])

>>>sig=urllib.quote_plus(base64.encodestring(hmac.new(secretkey,sig_url,hashlib.sha1).digest()).strip())

>>> req=url+request_url+'&signature='+sig
>>> res=urllib2.urlopen(req)
>>> res.read()
share|improve this answer
 
Hi nikhil Can u answer this question of mine? stackoverflow.com/questions/20877953/… –  ahmad05 Jan 2 at 7:04
add comment

Probably this example can help you,

Also have a look at their api ,

The wiki page is also a good one to start working with the api.

share|improve this answer
 
Hi Ruben Can you Please answer this question of mine stackoverflow.com/questions/20877953/… –  ahmad05 Jan 2 at 7:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.