[Owncloud] Sharing files/folders via REST API in oc6
Thomas Müller
thomas.mueller at tmit.eu
Fri Nov 8 15:50:55 UTC 2013
There is a pull request fixing this:
https://github.com/owncloud/core/pull/5763
Take care,
Tom
Am Freitag, den 08.11.2013 um 16:41 schrieb Jakub Moscicki:
> 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 at owncloud.com<mailto:dubiniuk at 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 at kde.org<mailto:Owncloud at kde.org>
> https://mail.kde.org/mailman/listinfo/owncloud
>
>
> _______________________________________________
> Owncloud mailing list
> Owncloud at kde.org<mailto:Owncloud at kde.org>
> https://mail.kde.org/mailman/listinfo/owncloud
>
>
> _______________________________________________
> Owncloud mailing list
> Owncloud at kde.org
> https://mail.kde.org/mailman/listinfo/owncloud
>
More information about the Owncloud
mailing list