If you aren't using AJAX calls or something else that shares the browser's cookies and sends them automatically, we have a mechanism that will let you manually set the session ID in your request. We use this mechanism in our Flash uploader since it does not use the browser's cookies.<div>
<br></div><div>You will need to pass the session ID down to the application that needs it. You can get the current session ID by calling session_id() with no parameters. (<a href="http://php.net/manual/en/function.session-id.php">http://php.net/manual/en/function.session-id.php</a>)</div>
<div><br></div><div>Now that your application knows the session ID, you can pass it with your request by adding the POST parameter "sid" set to the session ID. Midas currently requires you to POST the parameter for security reasons. The "useSession" parameter should work then.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Zach</div><div><br></div><div><br><div class="gmail_quote">On Thu, Jun 28, 2012 at 12:51 PM, Zach Mullen <span dir="ltr"><<a href="mailto:zach.mullen@kitware.com" target="_blank">zach.mullen@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mona,<div><br></div><div>It looks like the session isn't being shared properly with Annio. Is Annio calling the web API using javascript AJAX calls, or something else?</div>
<div><br></div><div>Thanks,</div><div><br>
</div><div>Zach<div><div class="h5"><br><br><div class="gmail_quote">On Wed, Jun 27, 2012 at 8:56 PM, Mona Wong <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi Zach:<br>
<br>
I'm trying to get the useSession parameter working for the web API call from the application Annio but am getting "{"stat":"fail","message":"This item doesn't exist or you don't have the permissions.","code":-151}" returned instead.<br>
<br>
The interesting thing is that I am able to make the call manually in my browser and it works.<br>
<br>
Annio and Midas are installed on the same server (<a href="http://idash-images.sdsc.edu/annio/" target="_blank">http://idash-images.sdsc.edu/annio/</a> and <a href="http://idash-images.sdsc.edu/midas/" target="_blank">http://idash-images.sdsc.edu/midas/</a>, respectively) and I know the session has not expired yet.<br>
<br>
Any other idea why Annio get a failure result while the browser works fine?<br>
<br>
thanks,<br>
<div>Mona<br>
<br>
<br>
On Jun 25, 2012, at 6:14 PM, Zach Mullen wrote:<br>
<br>
</div><div>> You may be able to use the session for this; if you pass the "useSession" parameter to a web API method, it will attempt to use session authentication instead of the web API token, but this only works for clients that support session cookies. So the question is, how is Annio going to write data back into Midas? If the application is running in the same place as Midas, you should be able to just pass useSession to the web API assuming the user's session is still active. That seems to me that it would work because Annio is an HTML5 application and is running in the browser, so it would have all of the same session cookies from the Midas instance.<br>
><br>
><br>
> Thanks,<br>
><br>
> Zach<br>
<br>
</div><div>*********************************************<br>
Mona Wong<br>
Web & iPad Application Developer<br>
San Diego Supercomputer Center<br>
<br>
</div><div><div> You are the light you wish to see.<br>
*********************************************<br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>
</div>