[prev in list] [next in list] [prev in thread] [next in thread]
List: owncloud
Subject: Re: [Owncloud] Sharing files/folders via REST API in oc6
From: Victor Dubiniuk <dubiniuk () owncloud ! com>
Date: 2013-11-06 19:28:52
Message-ID: 527A9874.8010409 () owncloud ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi Vincent,
this issue looks like similar to yours
https://github.com/owncloud/core/issues/5729
You can update it with your details.
Victor
On 11/06/2013 06:56 PM, Vincent H wrote:
> Hi,
>
> Sending this to the mailinglist on advice of Rancor:
>
> After trying to use the sharing api (via REST) in oc5
> (http://forum.owncloud.org/viewtopic.php?f=23&t=17952), which doesn't
> work, I am now trying it in oc6 beta 2. I think it is still a little
> buggy and I guess it has something to do with the user
> session/credentials.
>
> Environment:Local
> Server:Windows 7 with WAMP
> Database: Mysql 5.5.24
> Client: Firefox (and others)
> OC-Version: 6 beta2
> PHP-Version: Apache/2.2.22 (Win64) PHP/5.4.3
>
> I installed oc6 (beta 2) out of the box and created a share on a
> folder. After that, I tried the following scenarios:
>
> 1. Not logged in to oc6 via the browser (so no existing session)
> Call REST GET url:
> http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares
> Credentials are asked by the browser (http basic authentication),
> after filling them in (correctly), the request breaks with Fatal
> error: Call to a member function getRoot() on a non-object in
> \owncloud\lib\private\files\filesystem.php on line 407
>
> 2. Logged in normally to oc6 via the browser and open a new tab and op
> en the REST url again
> Call REST GET url:
> http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares
> This works, I get a nice XML message with all info about existing shares
>
> 3. Now refresh the page with the REST GET url at step 2.
> Now the page breaks with Fatal error: Call to a member function
> getRoot() on a non-object in
> \owncloud\lib\private\files\filesystem.php on line 407
>
> If the page with the normal login to oc6 is refreshed a redirect is
> done to the login screen. After a new login and refreshing the shares
> url, this works again exactly 1 time.
>
> It look like the REST call does something with the user session or
> something.
>
> My goal is to share a folder from Java code, running it from there
> (via restlet) always results in the same Fatal error.
>
> ClientResource resource = new
> ClientResource("http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares");
> // Send an authenticated request using the Basic authentication scheme.
> resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, "admin",
> "welcome1");
> // Send the request
> resource.get();
> Representation content = resource.get();
> System.out.println(content.getText());
>
> When trying all the above steps with a basic call:
> http://localhost/owncloud/ocs/v1.php/cloud/user (also requires a user
> session, thus a login) all works out fine, including the call from
> Java code.
>
> Any ideas? Or maybe another approach to achieve this via Java code?
>
> Kind regards,
>
>
> _______________________________________________
> Owncloud mailing list
> Owncloud@kde.org
> https://mail.kde.org/mailman/listinfo/owncloud
[Attachment #5 (text/html)]
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Vincent,<br>
<br>
this issue looks like similar to yours
<a class="moz-txt-link-freetext" \
href="https://github.com/owncloud/core/issues/5729">https://github.com/owncloud/core/issues/5729</a><br>
You can update it with your details.<br>
<br>
Victor<br>
<br>
On 11/06/2013 06:56 PM, Vincent H wrote:<br>
</div>
<blockquote cite="mid:SNT148-W3292F4C99EECD6E12B760CC4F00@phx.gbl"
type="cite">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
<div>Sending this to the mailinglist on advice of Rancor:</div>
<div><br>
</div>
<div>After trying to use the sharing api (via REST) in oc5
(<a class="moz-txt-link-freetext" \
href="http://forum.owncloud.org/viewtopic.php?f=23&t=17952">http://forum.owncloud.org/viewtopic.php?f=23&t=17952</a>),
which doesn't work, I am now trying it in oc6 beta 2. I think
it is still a little buggy and I guess it has something to do
with the user session/credentials.</div>
<div><br>
</div>
<div>Environment:Local</div>
<div>Server:Windows 7 with WAMP</div>
<div>Database: Mysql 5.5.24</div>
<div>Client: Firefox (and others)</div>
<div>OC-Version: 6 beta2</div>
<div>PHP-Version: Apache/2.2.22 (Win64) PHP/5.4.3</div>
<div><br>
</div>
<div>I installed oc6 (beta 2) out of the box and created a share
on a folder. After that, I tried the following scenarios:</div>
<div><br>
</div>
<div>1. Not logged in to oc6 via the browser (so no existing
session)</div>
<div>Call REST GET url:
<a class="moz-txt-link-freetext" \
href="http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares">http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares</a> </div>
<div>Credentials are asked by the browser (http basic
authentication), after filling them in (correctly), the
request breaks with Fatal error: Call to a member function
getRoot() on a non-object in
\owncloud\lib\private\files\filesystem.php on line 407</div>
<div><br>
</div>
<div>2. Logged in normally to oc6 via the browser and open a new
tab and op en the REST url again</div>
<div>Call REST GET url:
<a class="moz-txt-link-freetext" \
href="http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares">http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares</a> </div>
<div>This works, I get a nice XML message with all info about
existing shares</div>
<div><br>
</div>
<div>3. Now refresh the page with the REST GET url at step 2.</div>
<div>Now the page breaks with Fatal error: Call to a member
function getRoot() on a non-object in
\owncloud\lib\private\files\filesystem.php on line 407</div>
<div><br>
</div>
<div>If the page with the normal login to oc6 is refreshed a
redirect is done to the login screen. After a new login and
refreshing the shares url, this works again exactly 1 time.</div>
<div><br>
</div>
<div>It look like the REST call does something with the user
session or something.</div>
<div><br>
</div>
<div>My goal is to share a folder from Java code, running it
from there (via restlet) always results in the same Fatal
error.</div>
<div><br>
</div>
<div>ClientResource resource = new
ClientResource(<a class="moz-txt-link-rfc2396E" \
href="http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares">"http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares"</a>);</div>
<div>// Send an authenticated request using the Basic
authentication scheme.</div>
<div>resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC,
"admin", "welcome1");</div>
<div>// Send the request</div>
<div>resource.get();</div>
<div>Representation content = resource.get();</div>
<div>System.out.println(content.getText());</div>
<div><br>
</div>
<div>When trying all the above steps with a basic call:
<a class="moz-txt-link-freetext" \
href="http://localhost/owncloud/ocs/v1.php/cloud/user">http://localhost/owncloud/ocs/v1.php/cloud/user</a> \
(also requires a user session, thus a login) all works out fine, including
the call from Java code.</div>
<div><br>
</div>
<div>Any ideas? Or maybe another approach to achieve this via
Java code?</div>
<div><br>
</div>
<div>Kind regards,</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Owncloud mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:Owncloud@kde.org">Owncloud@kde.org</a> <a class="moz-txt-link-freetext" \
href="https://mail.kde.org/mailman/listinfo/owncloud">https://mail.kde.org/mailman/listinfo/owncloud</a>
</pre>
</blockquote>
<br>
</body>
</html>
_______________________________________________
Owncloud mailing list
Owncloud@kde.org
https://mail.kde.org/mailman/listinfo/owncloud
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic