[Owncloud] Sharing files/folders via REST API in oc6
Victor Dubiniuk
dubiniuk at owncloud.com
Wed Nov 6 19:28:52 UTC 2013
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 at kde.org
> https://mail.kde.org/mailman/listinfo/owncloud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20131106/29da7aa9/attachment.html>
More information about the Owncloud
mailing list