<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><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 (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.</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: http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares </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: http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares </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("http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares");</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: 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.</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></body>
</html>