You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Asmita Vagyani <As...@sigma-systems.com> on 2013/01/15 12:00:05 UTC

Cloudstack API calls

Hi all,

After installing management server I am trying to call a cloudstack API -

#curl --user "admin:sigma123" "http://localhost:8080/client/api?command=listAccountskeypair=bXFnKCix8VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"

<?xml version="1.0" encoding="UTF-8"?><errorresponse cloud-stack-version="4.0.0.20121024012150"><errorcode>432</errorcode><errortext>The given command does not exist</errortext></errorresponse>[root@torvm-cloudstack-mgmt ~]#

I am getting an error saying command doesnot exist.

I generated the signature using 
# echo -n "value" | openssl sha1 -hmac "keypair=bXFnKCix8VhhEGunkFbzqniHwYjgVUFr7KrUbKIc_g_tH8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA"

Let me know if I am missing something.

Thanks and Regards.

Asmita Patil Vagyani. 


-----Original Message-----
From: Aleksey Samarin [mailto:nrg3tik@gmail.com] 
Sent: 15 January 2013 PM 03:32
To: cloudstack-users@incubator.apache.org
Subject: Router problem

Hello everybody!

I have a wierd problem with virtual router, after create, guest network works fine but gateway to internet is unreachable.
Btw ssvm and cpvm works great and using internet.
I using cs4 on ubuntu, advanced network.

All the best


RE: Cloudstack API calls

Posted by James Osbourn <ja...@citrix.com>.
It looks like you have missed an & in your API call after the command to split the command from the keypair entry.  Try #curl --user "admin:sigma123" "http://localhost:8080/client/api?command=listAccounts&keypair=bXFnKCix8VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"

James

> -----Original Message-----
> From: Asmita Vagyani [mailto:Asmita.Vagyani@sigma-systems.com]
> Sent: 15 January 2013 11:00
> To: 'cloudstack-users@incubator.apache.org'
> Subject: Cloudstack API calls
> 
> Hi all,
> 
> After installing management server I am trying to call a cloudstack API -
> 
> #curl --user "admin:sigma123"
> "http://localhost:8080/client/api?command=listAccountskeypair=bXFnKCix8
> VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-
> PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> 
> <?xml version="1.0" encoding="UTF-8"?><errorresponse cloud-stack-
> version="4.0.0.20121024012150"><errorcode>432</errorcode><errortext>T
> he given command does not
> exist</errortext></errorresponse>[root@torvm-cloudstack-mgmt ~]#
> 
> I am getting an error saying command doesnot exist.
> 
> I generated the signature using
> # echo -n "value" | openssl sha1 -hmac
> "keypair=bXFnKCix8VhhEGunkFbzqniHwYjgVUFr7KrUbKIc_g_tH8gWgwHc3W
> B0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA"
> 
> Let me know if I am missing something.
> 
> Thanks and Regards.
> 
> Asmita Patil Vagyani.
> 
> 
> -----Original Message-----
> From: Aleksey Samarin [mailto:nrg3tik@gmail.com]
> Sent: 15 January 2013 PM 03:32
> To: cloudstack-users@incubator.apache.org
> Subject: Router problem
> 
> Hello everybody!
> 
> I have a wierd problem with virtual router, after create, guest network works
> fine but gateway to internet is unreachable.
> Btw ssvm and cpvm works great and using internet.
> I using cs4 on ubuntu, advanced network.
> 
> All the best


Re: Cloudstack API calls

Posted by Chris Sears <ch...@sungard.com>.
Asmita,

You might want to look at the following Python sample for how to generate
the signature:
https://github.com/kdamage/IndividualCode/blob/master/CloudStack%20API%20Signing%20Class/SignedAPICall.py

I noticed in your openssl command, you only used the "keypair=..." part of
the query string. I think you need to include the entire query string, such
as "command=listAccounts&keypair=...".

 - Chris


On Tue, Jan 15, 2013 at 7:21 AM, James Osbourn <ja...@citrix.com>wrote:

> I had problems generating API calls and generated a script to assist me
> which I have attached to my response.  This is a perl script which takes a
> number of argument and either returns the API call string or makes the call
> for you.  You should be able to use this as a basis for anything else you
> wish to achieve.
>
> James
>
> > -----Original Message-----
> > From: Asmita Vagyani [mailto:Asmita.Vagyani@sigma-systems.com]
> > Sent: 15 January 2013 11:25
> > To: 'cloudstack-users@incubator.apache.org'
> > Subject: RE: Cloudstack API calls
> >
> > Thnx Prasanna, James,
> >
> > Using the url provided by James, I could invoke the API.
> >
> > ]# curl --user "admin:sigma123"
> > "http://localhost:8080/client/api?command=listAccounts&keypair=bXFnKCix
> > 8VhhEGunkFbo0-
> > PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> > Response:
> >
> > <?xml version="1.0" encoding="UTF-8"?><listaccountsresponse cloud-stack-
> > version="4.0.0.20121024012150"><errorcode>401</errorcode><errortext>u
> > nable to verify user credentials and/or request
> > signature</errortext></listaccountsresponse>
> >
> > The credentials were not correct.
> > How do you create the api key  and the signature, I dint quite
> understand the
> > documentation for this, please guide.
> >
> > @Prasanna : We cannot use cloudmonkey interface because we don't
> > manually call the APIs. We have our own provisioning system, which makes
> a
> > call to the REST APIs that the Cloudstack provides.
> >
> > Thanks and Regards.
> >
> > Asmita Patil Vagyani.
> >
> >
> > -----Original Message-----
> > From: prasanna [mailto:srivatsav.prasanna@gmail.com] On Behalf Of
> > Prasanna Santhanam
> > Sent: 15 January 2013 PM 04:33
> > To: cloudstack-users@incubator.apache.org
> > Subject: Re: Cloudstack API calls
> >
> > On Tue, Jan 15, 2013 at 04:30:05PM +0530, Asmita Vagyani wrote:
> > > Hi all,
> > >
> > > After installing management server I am trying to call a cloudstack
> > > API -
> > >
> > > #curl --user "admin:sigma123"
> > >
> > "http://localhost:8080/client/api?command=listAccountskeypair=bXFnKCix8
> > VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-
> > PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> > >
> > > <?xml version="1.0" encoding="UTF-8"?><errorresponse
> > > cloud-stack-
> > version="4.0.0.20121024012150"><errorcode>432</errorcode><
> > > errortext>The given command does not
> > > exist</errortext></errorresponse>[root@torvm-cloudstack-mgmt ~]#
> > >
> > > I am getting an error saying command doesnot exist.
> > >
> > > I generated the signature using
> > > # echo -n "value" | openssl sha1 -hmac
> > >
> > "keypair=bXFnKCix8VhhEGunkFbzqniHwYjgVUFr7KrUbKIc_g_tH8gWgwHc3W
> > B0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA"
> > >
> > Try cloudmonkey:
> > https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+clou
> > dmonkey+CLI
> >
> > It encapsulates what you are trying to do through an autcompleteing CLI.
> >
> >
> > --
> > Prasanna.,
> >
>
>

RE: Cloudstack API calls

Posted by James Osbourn <ja...@citrix.com>.
I had problems generating API calls and generated a script to assist me which I have attached to my response.  This is a perl script which takes a number of argument and either returns the API call string or makes the call for you.  You should be able to use this as a basis for anything else you wish to achieve.

James

> -----Original Message-----
> From: Asmita Vagyani [mailto:Asmita.Vagyani@sigma-systems.com]
> Sent: 15 January 2013 11:25
> To: 'cloudstack-users@incubator.apache.org'
> Subject: RE: Cloudstack API calls
> 
> Thnx Prasanna, James,
> 
> Using the url provided by James, I could invoke the API.
> 
> ]# curl --user "admin:sigma123"
> "http://localhost:8080/client/api?command=listAccounts&keypair=bXFnKCix
> 8VhhEGunkFbo0-
> PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> Response:
> 
> <?xml version="1.0" encoding="UTF-8"?><listaccountsresponse cloud-stack-
> version="4.0.0.20121024012150"><errorcode>401</errorcode><errortext>u
> nable to verify user credentials and/or request
> signature</errortext></listaccountsresponse>
> 
> The credentials were not correct.
> How do you create the api key  and the signature, I dint quite understand the
> documentation for this, please guide.
> 
> @Prasanna : We cannot use cloudmonkey interface because we don't
> manually call the APIs. We have our own provisioning system, which makes a
> call to the REST APIs that the Cloudstack provides.
> 
> Thanks and Regards.
> 
> Asmita Patil Vagyani.
> 
> 
> -----Original Message-----
> From: prasanna [mailto:srivatsav.prasanna@gmail.com] On Behalf Of
> Prasanna Santhanam
> Sent: 15 January 2013 PM 04:33
> To: cloudstack-users@incubator.apache.org
> Subject: Re: Cloudstack API calls
> 
> On Tue, Jan 15, 2013 at 04:30:05PM +0530, Asmita Vagyani wrote:
> > Hi all,
> >
> > After installing management server I am trying to call a cloudstack
> > API -
> >
> > #curl --user "admin:sigma123"
> >
> "http://localhost:8080/client/api?command=listAccountskeypair=bXFnKCix8
> VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-
> PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> >
> > <?xml version="1.0" encoding="UTF-8"?><errorresponse
> > cloud-stack-
> version="4.0.0.20121024012150"><errorcode>432</errorcode><
> > errortext>The given command does not
> > exist</errortext></errorresponse>[root@torvm-cloudstack-mgmt ~]#
> >
> > I am getting an error saying command doesnot exist.
> >
> > I generated the signature using
> > # echo -n "value" | openssl sha1 -hmac
> >
> "keypair=bXFnKCix8VhhEGunkFbzqniHwYjgVUFr7KrUbKIc_g_tH8gWgwHc3W
> B0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA"
> >
> Try cloudmonkey:
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+clou
> dmonkey+CLI
> 
> It encapsulates what you are trying to do through an autcompleteing CLI.
> 
> 
> --
> Prasanna.,
> 


RE: Cloudstack API calls

Posted by Asmita Vagyani <As...@sigma-systems.com>.
Thnx Prasanna, James,

Using the url provided by James, I could invoke the API.

]# curl --user "admin:sigma123" "http://localhost:8080/client/api?command=listAccounts&keypair=bXFnKCix8VhhEGunkFbo0-PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
Response:

<?xml version="1.0" encoding="UTF-8"?><listaccountsresponse cloud-stack-version="4.0.0.20121024012150"><errorcode>401</errorcode><errortext>unable to verify user credentials and/or request signature</errortext></listaccountsresponse>

The credentials were not correct.
How do you create the api key  and the signature, I dint quite understand the documentation for this, please guide.

@Prasanna : We cannot use cloudmonkey interface because we don't manually call the APIs. We have our own provisioning system, which makes a call to the REST APIs that the Cloudstack provides.

Thanks and Regards.

Asmita Patil Vagyani. 


-----Original Message-----
From: prasanna [mailto:srivatsav.prasanna@gmail.com] On Behalf Of Prasanna Santhanam
Sent: 15 January 2013 PM 04:33
To: cloudstack-users@incubator.apache.org
Subject: Re: Cloudstack API calls

On Tue, Jan 15, 2013 at 04:30:05PM +0530, Asmita Vagyani wrote:
> Hi all,
> 
> After installing management server I am trying to call a cloudstack 
> API -
> 
> #curl --user "admin:sigma123"
> "http://localhost:8080/client/api?command=listAccountskeypair=bXFnKCix8VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> 
> <?xml version="1.0" encoding="UTF-8"?><errorresponse 
> cloud-stack-version="4.0.0.20121024012150"><errorcode>432</errorcode><
> errortext>The given command does not 
> exist</errortext></errorresponse>[root@torvm-cloudstack-mgmt ~]#
> 
> I am getting an error saying command doesnot exist.
> 
> I generated the signature using
> # echo -n "value" | openssl sha1 -hmac 
> "keypair=bXFnKCix8VhhEGunkFbzqniHwYjgVUFr7KrUbKIc_g_tH8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA"
> 
Try cloudmonkey:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI

It encapsulates what you are trying to do through an autcompleteing CLI.


--
Prasanna.,



Re: Cloudstack API calls

Posted by Prasanna Santhanam <ts...@apache.org>.
On Tue, Jan 15, 2013 at 04:30:05PM +0530, Asmita Vagyani wrote:
> Hi all,
> 
> After installing management server I am trying to call a cloudstack API -
> 
> #curl --user "admin:sigma123"
> "http://localhost:8080/client/api?command=listAccountskeypair=bXFnKCix8VhhEGunkFbz8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA\&signature=eaddca273cba89aacf4d0472356516586e2b24f8"
> 
> <?xml version="1.0" encoding="UTF-8"?><errorresponse cloud-stack-version="4.0.0.20121024012150"><errorcode>432</errorcode><errortext>The given command does not exist</errortext></errorresponse>[root@torvm-cloudstack-mgmt ~]#
> 
> I am getting an error saying command doesnot exist.
> 
> I generated the signature using 
> # echo -n "value" | openssl sha1 -hmac
> "keypair=bXFnKCix8VhhEGunkFbzqniHwYjgVUFr7KrUbKIc_g_tH8gWgwHc3WB0Tg7m3nE7LujhYo0-PGixkjOhtb2gKA"
> 
Try cloudmonkey:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI

It encapsulates what you are trying to do through an autcompleteing
CLI.


-- 
Prasanna.,