Return-Path: X-Original-To: apmail-cloudstack-users-archive@www.apache.org Delivered-To: apmail-cloudstack-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4B4E11A0B for ; Mon, 2 Jun 2014 17:27:52 +0000 (UTC) Received: (qmail 12286 invoked by uid 500); 2 Jun 2014 17:27:51 -0000 Delivered-To: apmail-cloudstack-users-archive@cloudstack.apache.org Received: (qmail 12219 invoked by uid 500); 2 Jun 2014 17:27:51 -0000 Mailing-List: contact users-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cloudstack.apache.org Delivered-To: mailing list users@cloudstack.apache.org Received: (qmail 12172 invoked by uid 99); 2 Jun 2014 17:27:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2014 17:27:51 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of smidh.d@gmail.com designates 209.85.217.178 as permitted sender) Received: from [209.85.217.178] (HELO mail-lb0-f178.google.com) (209.85.217.178) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2014 17:27:45 +0000 Received: by mail-lb0-f178.google.com with SMTP id w7so2692591lbi.37 for ; Mon, 02 Jun 2014 10:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=DDUQKjCcc4fTuNqY1DfzbjWP6XvpA+cyGNSOj+w0DjQ=; b=SVckcimQKV3jwycOOq0CEHRLwdAz8d5RlhtIUNpwqkMbmFFYtPysMGfNMkI1J7cOcY XapBN26K9ZQtTQjTlfmd8jivPP9WAtNXCOHSmVrCu95h3ggKfdg4p0m3ff+Tr5oyR9NB 8oylqoBtYwyKxcvr43KmlOaf8IwSDKhQJi5+3IF/BJiRSmmT6QcQvUP8XwJAJDk4PDKk LaMBwXJT+caLexV3mqIx806A8ewWwPcJX8SKOryVlAt29pndGnLHGM2yThJA68Pw2hkv VUr8nVf6uxT3ZXJZfoAH7RZtyS8m7QpDlAD9/sKZkpSlwSfWYbRP1tm4ZAihf2uIo8rT 2lrQ== MIME-Version: 1.0 X-Received: by 10.152.28.194 with SMTP id d2mr30241739lah.25.1401730044597; Mon, 02 Jun 2014 10:27:24 -0700 (PDT) Received: by 10.112.76.103 with HTTP; Mon, 2 Jun 2014 10:27:24 -0700 (PDT) In-Reply-To: References: Date: Tue, 3 Jun 2014 00:27:24 +0700 Message-ID: Subject: Re: Problem when using Cloudstack Login API From: dimas yoga pratama To: users@cloudstack.apache.org Content-Type: multipart/alternative; boundary=089e0160b420611c0c04faddb5d4 X-Virus-Checked: Checked by ClamAV on apache.org --089e0160b420611c0c04faddb5d4 Content-Type: text/plain; charset=UTF-8 Hi, Thanks Ove and Erik for your clear explanation I understand now. On Mon, Jun 2, 2014 at 2:25 PM, Erik Weber wrote: > On Sun, Jun 1, 2014 at 10:51 PM, dimas yoga pratama > wrote: > > > Hi All, > > > > I'm doing an experiment on using Cloudstack API. > > From what I read here > > http://cloudstack.apache.org/docs/api/apidocs-4.3/user/login.html when > the > > login succeeds,it will generate cookie JSESSIONID. > > My question is, when I create login page, and succsfull login will > redirect > > to another page, do I have to pass JSESSIONID to another page like > > SESSIONKEY? > > > > > Here's an example with curl. > > Remember that parameters has to be encoded if they contain any kind of > special characters. > > Login: > curl -i ' > > http://localhost:8080/client/api?command=login&user=admin&password=MyPassword&response=json > ' > returns a snippet like this: > > Set-Cookie: JSESSIONID=07CA185081E6A476775ECA9D190EF1F8; Path=/client > > { "loginresponse" : { "timeout" : "1800", "lastname" : "cloud", > "registered" : "false", "username" : "admin", "firstname" : "admin", > "domainid" : "6f920fbd-94fc-11e3-b2e0-0050568c15a3", "type" : "1", "userid" > : "d68e7072-94fc-11e3-b2e0-0050568c15a3", "sessionkey" : > "WxjAu9zZzbmrBGDarnW1cVfm+/g=", "account" : "admin" } } > > > Then you take the JSESSIONID and sessionkey and pass them as Ove said. > > List Zones example using above > > curl -i -H "Cookie: JSESSIONID=07CA185081E6A476775ECA9D190EF1F8; > Path=/client" ' > > http://localhost:8008/client/api?command=listZones&sessionkey=WxjAu9zZzbmrBGDarnW1cVfm%2B%2Fg%3D&response=json > ' > > > -- > > Erik Weber > --089e0160b420611c0c04faddb5d4--