cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Demetrius Tsitrelis <Demetrius.Tsitre...@citrix.com>
Subject RE: API calls and keys
Date Fri, 05 Sep 2014 20:37:59 GMT
What about using POST via AJAX instead of using implied GET in the link?

-----Original Message-----
From: Giri Prasad [mailto:g_pr23@yahoo.com.INVALID] 
Sent: Friday, September 05, 2014 4:47 AM
To: dev@cloudstack.apache.org; users@cloudstack.apache.org
Subject: Re: API calls and keys

I have implemented a few of the cs api calls via php, like listVirtualMachines, using CloudStackClient.
I need to implement the view console via a api call. I saw on some net posting's, the url
used:

http://xx.xx.xx.xx:8080/client/console?cmd=access&vm=xxxxxxxxx&signature=XXXXXX or
http://xx.xx.xx.xx:8080/client/api?cmd=access&vm=xxxxxxxxx&signature=XXXXXX

http://XXX.XXX.XXX.5:8080/client/console?cmd=access&vm=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

The need is to pass the string to the browser, without exposing the (secret key / api key)
signature, which will be showed in the browser url, when the user clicks on the link.  Or
is there any direct cloudstack api which can be called?

Any ideas on this?




________________________________
 From: abhisek basu <abhisekbasu@msn.com>
To: "users@cloudstack.apache.org" <users@cloudstack.apache.org>
Cc: "dev@cloudstack.apache.org" <dev@cloudstack.apache.org>
Sent: Wednesday, 3 September 2014 8:43 PM
Subject: Re: API calls and keys
 

You need to generate the signature; sample code us here: http://abhisekbasu.wordpress.com/2013/11/19/how-to-generate-signature-for-cloudstack-api/

You may also consider using login api in your scenario.

Sent from my iPhone


> On 3 Sep 2014, at 8:11 pm, "Giri Prasad" <g_pr23@yahoo.com.INVALID> wrote:
> 
> Hello,
> 
> I am using a html/php script to read in userid, password and domain id from the user.
 Using CloudStackClient.php, I am able to call most of the api's, like list vm's, and the
output seems correct.
> 
> And I want to use some API's via <a href ....>  like:
> 
> http://XXX.XXX.XXX.5:8080/client/api?command=startVirtualMachine&id=aa
> aaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
> http://XXX.XXX.XXX.5:8080/client/api?command=stopVirtualMachine&id=aaa
> aaaaa-bbbb-cccc-dddd-eeeeeeeeeeee 
> http://XXX.XXX.XXX.5:8080/client/console?cmd=access&vm=aaaaaaaa-bbbb-c
> ccc-dddd-eeeeeeeeeeee
> 
> I need to add dynamically the apikey and signature:
> 
> &apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXqjB8CG20YI3yaxXcgpyuaIRmFI_EJT
> VwZ0nUkkJbPmY3y2bciKwFQ &signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D
> 
> since apikey and signature are required, are there, any api's, where I can dynamically,
get it from the CS infra, and use the return values, for building the apiKey and signature
part of the url. 
> 
> 
> I need to get the apikey and signature dynamically, for a specific user (userid/passwd),
and then use it, for building the url.
> 
> 
> Thanks & Regards,
> Giri
> 
> Without apikeys and signature:
> <startvirtualmachineresponse 
> cloud-stack-version="4.1.1"><errorcode>401</errorcode><errortext>unabl
> e to verify user credentials and/or request 
> signature</errortext></startvirtualmachineresponse>
> 
> console?cmd=access
> Access denied. Invalid web session or API key in request
Mime
View raw message