What you're seeing is an empty zip file when trying to download the item.  That's because the permission check failed, which is actually a bug on our side because we are redirecting to a new controller that doesn't know about the api auth mechanism.<div>

<br></div><div>As a workaround, is your client able to handle cookies?  If so, you could use session-based authentication instead of the token.  If the client you're writing is javascript that lives on the same server, you can simply pass the "useSession" parameter instead of the token, and javascript automatically passes the appropriate cookie.  Java applets do the same thing.  If your client is something else, you could store and pass the cookie manually.</div>

<div><br></div><div>I will work on fixing this bug for now.  Thanks for the report.</div><div><br><div class="gmail_quote">On Mon, Jul 2, 2012 at 8:36 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"><div style="word-wrap:break-word"><div><br></div><div>Hi Midas:</div><div><br></div><span style="white-space:pre-wrap"> </span>I'm posting this on behalf of our developer who just signed up for the mailing list but has not been given permission to post yet...<br>

<div><br><div>Begin forwarded message:</div><br><blockquote type="cite"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="font-family:Tahoma;font-size:13px">---------------------------------------</span></div>

<span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<div style="direction:ltr;font-size:10pt;font-family:Tahoma"><p style="margin-top:0px;margin-bottom:0px"> </p><div style="margin-top:0px;margin-bottom:0px">I have a question about web API midas.item.download<a></a>. I have access to two items whose id are 18875 and 18876, respectively. Item 18875 is in user A's public folder. Item 18876 is in user A's private folder. For testing purpose, the contents of these items are actually same. I can access and download both items through Midas web interface.</div>

<p style="margin-top:0px;margin-bottom:0px"> </p><div style="margin-top:0px;margin-bottom:0px">Now, I want to download them using web API.</div><p style="margin-top:0px;margin-bottom:0px"> </p><div style="margin-top:0px;margin-bottom:0px">

First of all, I used midas.login<a></a><span> </span>and get a token. By calling midas.item.get<a></a>, I got the information about each item. So far so good.</div><p style="margin-top:0px;margin-bottom:0px"> </p><div style="margin-top:0px;margin-bottom:0px">

My next step was to download item 18875 using midas.item.download<a></a>, and it worked great.</div><div style="margin-top:0px;margin-bottom:0px">However, when I tried to download item 18876 using a similar command, it didn't return me the expected file. The command was:<br>

C:\test>curl -d "token=mytokenvalue&id<a></a>=18876" -L<a href="http://midas.test.edu/midas/api/json?method=midas.item.download" target="_blank">http://midas.test.edu/midas/api/json?method=midas.item.download</a><br>

PK<a></a>??<br>C:\test></div><p style="margin-top:0px;margin-bottom:0px"> </p><div style="margin-top:0px;margin-bottom:0px">What I got is several non-ASCII characters (PK<a></a>??). I also tried to download using Google Http Client and got the same result. Please help!</div>

<p style="margin-top:0px;margin-bottom:0px"> </p><p style="margin-top:0px;margin-bottom:0px"> </p><div style="font-size:16px;font-family:'Times New Roman'"><hr></div></div></div></span></blockquote></div><br><div>


<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">

<div>*********************************************</div><div>    Mona Wong</div><div>    Web & iPad Application Developer</div><div>    San Diego Supercomputer Center</div><div><br></div><div>    Believing we are in control is an</div>

<div>    illusion that brings suffering.</div><div><div><div>*********************************************</div><div><span style="font-size:medium"><br></span></div></div></div></div></span></div></span></div></span></div>

</span></div></span></div></span></div></span></div></span><br></div></span><br></span><br>
</div>
<br></div><br>_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Zach Mullen<br>R & D Engineer<br>Kitware Inc.<br>919-869-8858<br>
</div>