Sharing files/folders via REST API

Ask all your questions regarding OC 5.x Please read the Support Forum Rules
Forum rules
ownCloud 5.x reached end of life and is officially unsupported. For details see Wiki page.

Please upgrade your ownCloud.
vincenth
Newbie
Posts: 5
Joined: Mon Nov 04, 2013 3:32 pm
ownCloud version: 5.0.12
Webserver: Apache
Database: MySQL
OS: Windows Desktop
PHP version: 5.4.3

Sharing files/folders via REST API

Postby vincenth » Mon Nov 04, 2013 3:50 pm

Hi,

I need some help on getting/creating file/folder shares via the REST API (OCS Share API). OwnCloud is on a Windows WAMP server and I tried a lot of things, but the result of all API calls for the sharing part is status 999, invalid query.

Environment:Local
Server:Windows 7 with WAMP
Database: Mysql 5.5.24
Client: Firefox
OC-Version: 5.0.12 (enterprise)
PHP-Version: Apache/2.2.22 (Win64) PHP/5.4.3

A default REST GET works:
http://localhost/owncloud/ocs/v1.php/config

result:

Code: Select all

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <version>1.7</version>
  <website>ownCloud</website>
  <host>localhost</host>
  <contact></contact>
  <ssl>false</ssl>
 </data>
</ocs>


No I am trying to do this with the files_sharing options to list all shares (GET) via REST:
(all info derived from here: http://doc.owncloud.org/server/5.0/deve ... e-api.html)
http://localhost/owncloud/ocs/v1.php/ap ... /v1/shares

result:

Code: Select all

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>failed</status>
  <statuscode>999</statuscode>
  <message>Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:
debug output:
http request method: GET
http request uri: /owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares
</message>
 </meta>
</ocs>


I added the apps_paths to the config.php (where /apps contains the files_sharing folder and /apps2 is empty):

Code: Select all

 'apps_paths' => array (
      0 => array (
              'path'     => OC::$SERVERROOT.'/apps',
              'url'      => '/apps',
              'writable' => true,
      ),
      1 => array (
              'path'     => OC::$SERVERROOT.'/apps2',
              'url'      => '/apps2',
              'writable' => false,
      ),
  )


OwnCloud Tools:
No errors (only File Permissions doesn't work on Windows because of posix_getuid(), which is not available for Windows)

Sharing items via the web interface is not a problem.

Any help is appreciated!

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: Sharing files/folders via REST API

Postby RealRancor » Mon Nov 04, 2013 3:57 pm

Hi,

have you checked this request for an documentation of this REST API:

https://github.com/owncloud/documentation/issues/90

which contains some infos on how to use it? If you need more infos its probably better to directly ask the developers at the mailinglist:

https://mail.kde.org/mailman/listinfo/owncloud
*gone*

vincenth
Newbie
Posts: 5
Joined: Mon Nov 04, 2013 3:32 pm
ownCloud version: 5.0.12
Webserver: Apache
Database: MySQL
OS: Windows Desktop
PHP version: 5.4.3

Re: Sharing files/folders via REST API

Postby vincenth » Mon Nov 04, 2013 4:08 pm

Hi,

Thanks for the quick reply. Yes I did have a look at the request for documentation, that is were I found the first REST call (owncloud/ocs/v1.php/config) which actually works.

However, since the OCS Share API is documented at http://doc.owncloud.org/server/5.0/deve ... e-api.html, I expect this to work :) My guess is that I am missing something to get this part working, since none of the request are working on the mentoined base url (<owncloud_base_url>/ocs/v1.php/apps/files_sharing/api/v1).

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: Sharing files/folders via REST API

Postby RealRancor » Mon Nov 04, 2013 4:25 pm

Hi,

could be possible that this calls where added to master (oc6) but not to stable5 (oc 5.0.12). Check the github commit messages of the github repos for some infos:

https://github.com/owncloud/core/commits/master
https://github.com/owncloud/documentati ... ts/stable5
*gone*

vincenth
Newbie
Posts: 5
Joined: Mon Nov 04, 2013 3:32 pm
ownCloud version: 5.0.12
Webserver: Apache
Database: MySQL
OS: Windows Desktop
PHP version: 5.4.3

Re: Sharing files/folders via REST API

Postby vincenth » Mon Nov 04, 2013 5:12 pm

Hi,

I just downloaded oc6 beta, there it works out of the box (retrieving all shares via GET). Unfortunately, this version is not the one used by our client. I will see if I can also get it to work on oc5 enterprise edition.

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: Sharing files/folders via REST API

Postby RealRancor » Tue Nov 05, 2013 8:44 am

Hi,

you could ask one of the developers (github or mailinglist) if there are any plans to backport those API changes into stable5. If not you have to wait until OC 6 is released and see if your customer can switch to this new release.
*gone*


  • Similar Topics
    Replies
    Views
    Last post

Return to “ownCloud Community Edition 5.x and older”

Who is online

Users browsing this forum: No registered users and 1 guest