[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:       Jakub Moscicki <Jakub.Moscicki () cern ! ch>
Date:       2013-11-08 15:41:00
Message-ID: D851C319F44DDB4C9AA52DC2A56A04B9010377CE68 () CERNXCHG12 ! cern ! ch
[Download RAW message or body]

Hello,

With owncloud6-beta3 I have a similar issue:

# curl -X GET --user X:Y \
http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares

no output

# tail /var/log/owncloud.log
...
{"app":"PHP","message":"Call to a member function getRoot() on a non-object at \
\/var\/www\/html\/owncloud\/lib\/private\/files\/filesystem.php#413","level":3,"time":"2013-11-08T15:35:46+00:00"}


Best regards,

kuba

--

On Nov 6, 2013, at 8:28 PM, Victor Dubiniuk \
<dubiniuk@owncloud.com<mailto:dubiniuk@owncloud.com>>  wrote:

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"<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<mailto:Owncloud@kde.org>
https://mail.kde.org/mailman/listinfo/owncloud


_______________________________________________
Owncloud mailing list
Owncloud@kde.org<mailto:Owncloud@kde.org>
https://mail.kde.org/mailman/listinfo/owncloud


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "> Hello,
<div><br>
</div>
<div>With owncloud6-beta3 I have a similar issue:</div>
<div><br>
</div>
<div># curl -X GET --user X:Y <a \
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><br> </div>
<div>no output</div>
<div><br>
</div>
<div>#&nbsp;tail /var/log/owncloud.log</div>
<div>...</div>
<div>{&quot;app&quot;:&quot;PHP&quot;,&quot;message&quot;:&quot;Call to a member \
function getRoot() on a non-object at \
\/var\/www\/html\/owncloud\/lib\/private\/files\/filesystem.php#413&quot;,&quot;level&quot;:3,&quot;time&quot;:&quot;2013-11-08T15:35:46&#43;00:00&quot;}</div>
 <div><br>
</div>
<div>Best regards,</div>
<div><br>
</div>
<div>kuba</div>
<div><br>
</div>
<div>--</div>
<div><br>
<div>
<div>On Nov 6, 2013, at 8:28 PM, Victor Dubiniuk &lt;<a \
href="mailto:dubiniuk@owncloud.com">dubiniuk@owncloud.com</a>&gt;</div> \
<div>&nbsp;wrote:</div> <br class="Apple-interchange-newline">
<blockquote type="cite">
<div 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&amp;t=17952">http://forum.owncloud.org/viewtopic.php?f=23&amp;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>&nbsp;</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>&nbsp;</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">&quot;htt \
p://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares&quot;</a>);</div> \
<div>// Send an authenticated request using the Basic authentication scheme.</div> \
<div>resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, &quot;admin&quot;, \
&quot;welcome1&quot;);</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>
</div>
_______________________________________________<br>
Owncloud mailing list<br>
<a href="mailto:Owncloud@kde.org">Owncloud@kde.org</a><br>
https://mail.kde.org/mailman/listinfo/owncloud<br>
</blockquote>
</div>
<br>
</div>
</body>
</html>



_______________________________________________
Owncloud mailing list
Owncloud@kde.org
https://mail.kde.org/mailman/listinfo/owncloud

--===============5634046590290541995==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic