So, my next API question.  :)

I am getting a 401 with the following Java code.  A 401 is authentication
related, but I'm not sure if I need to provide a username and password
because I didn't see that in the example on the web that I'm following.

Any thoughts?

Thanks!

  final String strHost = "127.0.0.1:8080/";

   final String strFinalUrl = "http://"; + strHost + strApiUrl +
"&apiKey="+ strApiKey +
"&signature=" + strEncodedSignature;

   System.out.println(strFinalUrl);

   final HttpClient client = new DefaultHttpClient();

 final HttpResponse response = client.execute(new HttpGet(strFinalUrl));

   if (response.getStatusLine().getStatusCode() != 200)

 {

  throw new RuntimeException("Failed on CloudStack deployVirtualMachine API
call : HTTP error code : " + response.getStatusLine().getStatusCode());

 }

The URL I'm printing looks like this:


http://127.0.0.1:8080/client/api?command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=1&zoneId=1&apiKey=X0U60K_Qgodb6nL5csNcAzRiz2cKiwx-tjBj1dTMLSVxkdmD0QtUhFzDf3MCmwGnC3z2dQPo0j3x_XJYmoEBmg&signature=CJvLoJ%2ByvUM12OUNb9hxyD1Gsjw%3D



On Wed, Feb 13, 2013 at 12:06 PM, Mike Tutkowski <
mike.tutkow...@solidfire.com> wrote:

> Thanks, David - that was very useful info. :)
>
> I'm not completely up to speed yet on what CloudStack considers a domain
> versus an account versus a user, but I found this page and am going through
> it now:
>
> http://wiki.cloudstack.org/pages/viewpage.action?pageId=8224884
>
>
> On Wed, Feb 13, 2013 at 11:21 AM, David Grizzanti <
> david.grizza...@sungard.com> wrote:
>
>> Mike,
>>
>> In the UI if you go to "Accounts" in the left hand sidebar -> click the
>> name of an account (i.e. "admin") -> under Details click "View Users" ->
>> click the Username of the user in question (i.e. "admin") and the API and
>> Secrety Key should be listed under the Details there.
>>
>> Hope that helps!
>>
>> --
>> David Grizzanti
>> Software Engineer - SunGard Availability Services
>> 401 N. Broad Street, Philadelphia, PA 19108
>> o: 215-446-1431 - e: david.grizza...@sungard.com
>>
>> On Feb 13, 2013, at 12:44 PM, Mike Tutkowski wrote:
>>
>> > OK, just getting around to doing this now.
>> >
>> > It looks like the Generate Keys command worked (I didn't get an error
>> > message), but I'm not sure where to look in the GUI to find these keys.
>> >
>> > Would you mind pointing that out for me?
>> >
>> > Thanks!!
>> >
>> >
>> > On Tue, Feb 12, 2013 at 9:07 PM, Will Stevens <wstev...@cloudops.com>
>> wrote:
>> >
>> >> If its a fresh install, you will access the client at:
>> >> the.machines.ip:8080/client/
>> >> Login with username/password of: admin/password
>> >> Click: Accounts -> admin -> View Users -> admin -> (in the main window
>> >> there are 3 buttons at the top left of the screen, mouse over the right
>> >> most one of the 3 and it should say 'Generate Keys', click that)
>> >>
>> >> You can follow that same process for any user who has an account.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On Tue, Feb 12, 2013 at 10:26 PM, Mike Tutkowski <
>> >> mike.tutkow...@solidfire.com> wrote:
>> >>
>> >>> Can you point me to the location in the GUI where I can generate keys?
>> >>>
>> >>> Thanks!
>> >>>
>> >>>
>> >>> On Tue, Feb 12, 2013 at 4:17 PM, Will Stevens <wstev...@cloudops.com>
>> >>> wrote:
>> >>>
>> >>>> They do not expire, but in the UI you can regenerate the keys, so in
>> >> that
>> >>>> case they would change.
>> >>>>
>> >>>>
>> >>>> On Tue, Feb 12, 2013 at 6:13 PM, Mike Tutkowski <
>> >>>> mike.tutkow...@solidfire.com> wrote:
>> >>>>
>> >>>>> to "say" (I mean) :)
>> >>>>>
>> >>>>>
>> >>>>> On Tue, Feb 12, 2013 at 4:13 PM, Mike Tutkowski <
>> >>>>> mike.tutkow...@solidfire.com> wrote:
>> >>>>>
>> >>>>>> Sounds good...and these do not expire?  Is that accurate to day?
>> >>>>>>
>> >>>>>>
>> >>>>>> On Tue, Feb 12, 2013 at 4:03 PM, Will Stevens <
>> >> wstev...@cloudops.com
>> >>>>>> wrote:
>> >>>>>>
>> >>>>>>> Every role uses the same procedure.  They all need an api key and
>> >>>> secret
>> >>>>>>> key.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> On Tue, Feb 12, 2013 at 5:54 PM, Mike Tutkowski <
>> >>>>>>> mike.tutkow...@solidfire.com> wrote:
>> >>>>>>>
>> >>>>>>>> Thanks for the info.
>> >>>>>>>>
>> >>>>>>>> So, I see we have three roles in CloudStack:  Root Admin, Domain
>> >>>>> Admin,
>> >>>>>>> and
>> >>>>>>>> User.
>> >>>>>>>>
>> >>>>>>>> When submitting API commands, does the submitter - regardless of
>> >>>> role
>> >>>>> -
>> >>>>>>>> have to provide an API Key and Secret Key (or is that something,
>> >>>> say,
>> >>>>>>> the
>> >>>>>>>> Root Admin doesn't have to do)?
>> >>>>>>>>
>> >>>>>>>> Thanks!
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> On Tue, Feb 12, 2013 at 3:33 PM, David Nalley <da...@gnsa.us>
>> >>>> wrote:
>> >>>>>>>>
>> >>>>>>>>> On Tue, Feb 12, 2013 at 5:27 PM, Mike Tutkowski
>> >>>>>>>>> <mike.tutkow...@solidfire.com> wrote:
>> >>>>>>>>>> So, I'm looking at these comments now:
>> >>>>>>>>>>
>> >>>>>>>>>> 2.3. Getting Started
>> >>>>>>>>>> To get started using the CloudStack API, you should have the
>> >>>>>>> following:
>> >>>>>>>>>>
>> >>>>>>>>>>   - URL of the CloudStack server you wish to integrate
>> >> with.
>> >>>>>>>>>>   - Both the API Key and Secret Key for an account. This
>> >>> should
>> >>>>>>> have
>> >>>>>>>>> been
>> >>>>>>>>>>   generated by the administrator of the cloud instance and
>> >>>> given
>> >>>>> to
>> >>>>>>>> you.
>> >>>>>>>>>>   - Familiarity with HTTP GET/POST and query strings.
>> >>>>>>>>>>   - Knowledge of either XML or JSON.
>> >>>>>>>>>>   - Knowledge of a programming language that can generate
>> >>> HTTP
>> >>>>>>>> requests;
>> >>>>>>>>>>   for example, Java or PHP.
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> I'm not sure how to generate the API Key and Secret Key for
>> >> an
>> >>>>>>> account.
>> >>>>>>>>>> Can someone point me to instructions for this?
>> >>>>>>>>>>
>> >>>>>>>>>> Thanks!
>> >>>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>
>> >>>>
>> >>>
>> >>
>> http://incubator.apache.org/cloudstack/docs/api/apidocs-4.0.0/root_admin/registerUserKeys.html
>> >>>>>>>>> Please file a bug for the DevGuide documentation not being
>> >> clear
>> >>>> on
>> >>>>>>> this
>> >>>>>>>>> issue
>> >>>>>>>>>
>> >>>>>>>>> -David
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> --
>> >>>>>>>> *Mike Tutkowski*
>> >>>>>>>> *Senior CloudStack Developer, SolidFire Inc.*
>> >>>>>>>> e: mike.tutkow...@solidfire.com
>> >>>>>>>> o: 303.746.7302
>> >>>>>>>> Advancing the way the world uses the
>> >>>>>>>> cloud<http://solidfire.com/solution/overview/?video=play>
>> >>>>>>>> *™*
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> --
>> >>>>>> *Mike Tutkowski*
>> >>>>>> *Senior CloudStack Developer, SolidFire Inc.*
>> >>>>>> e: mike.tutkow...@solidfire.com
>> >>>>>> o: 303.746.7302
>> >>>>>> Advancing the way the world uses the cloud<
>> >>>>> http://solidfire.com/solution/overview/?video=play>
>> >>>>>> *™*
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> *Mike Tutkowski*
>> >>>>> *Senior CloudStack Developer, SolidFire Inc.*
>> >>>>> e: mike.tutkow...@solidfire.com
>> >>>>> o: 303.746.7302
>> >>>>> Advancing the way the world uses the
>> >>>>> cloud<http://solidfire.com/solution/overview/?video=play>
>> >>>>> *™*
>> >>>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> *Mike Tutkowski*
>> >>> *Senior CloudStack Developer, SolidFire Inc.*
>> >>> e: mike.tutkow...@solidfire.com
>> >>> o: 303.746.7302
>> >>> Advancing the way the world uses the
>> >>> cloud<http://solidfire.com/solution/overview/?video=play>
>> >>> *™*
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> > *Mike Tutkowski*
>> > *Senior CloudStack Developer, SolidFire Inc.*
>> > e: mike.tutkow...@solidfire.com
>> > o: 303.746.7302
>> > Advancing the way the world uses the
>> > cloud<http://solidfire.com/solution/overview/?video=play>
>> > *™*
>>
>>
>
>
> --
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkow...@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the 
> cloud<http://solidfire.com/solution/overview/?video=play>
> *™*
>



-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkow...@solidfire.com
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*

Reply via email to