Get share information
Is your feature request related to a problem? Please describe. We would like to find out if a share for a file or folder already has been created, before we create another one. As far as I can tell, this is not possible.
Describe the solution you'd like Instead of using createShare to get the share.url, I think it would be better to have a command like getShareInfo or such and call this API as described here: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html#get-shares-from-a-specific-file-or-folder
Regards and thanks alot for this great package!!
Hi sushibear, great requirement. It is not yet planned.
There is only an API to get all the shares of a user and to query share information. A file/folder can have many shares. If your find multiple shares, you have to decide if the desired share is already available.
I would extend the API of File and Folder with the method File.getShares() / Folder.getShares() This method will return a list of share objects of the File/Folder.
This will be my next activity. But I can make no promises when it will be available.
Implementation: GET https://..../ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=%2Fp1%2Fp2%2Fp3&reshares=true
{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":[{"id":"54","share_type":3,"uid_owner":"xxx","displayname_owner":"xxx","permissions":17,"can_edit":true,"can_delete":true,"stime":1607531674,"parent":null,"expiration":null,"token":"Gwr8LMXTGAjW2o3","uid_file_owner":"xxx","note":"","label":"","displayname_file_owner":"xxx","path":"/p1/p2/p3","item_type":"folder","mimetype":"httpd/unix-directory","storage_id":"home::xxx","storage":2,"item_source":60991,"file_source":60991,"file_parent":15465,"file_target":"/p3","share_with":null,"share_with_displayname":"(Geteilter Link)","password":null,"send_password_by_talk":false,"url":"http://...../index.php/s/Gwr8LMXTGAjW2o3","mail_send":0,"hide_download":0},{"id":"55","share_type":3,"uid_owner":"xxx","displayname_owner":"xxx","permissions":17,"can_edit":true,"can_delete":true,"stime":1607534317,"parent":null,"expiration":null,"token":"Kw5qTZWcdXnN3Y5","uid_file_owner":"xxxx","note":"","label":"","displayname_file_owner":"xxx","path":"/p1/p2/p3","item_type":"folder","mimetype":"httpd/unix-directory","storage_id":"home::holger","storage":2,"item_source":60991,"file_source":60991,"file_parent":15465,"file_target":"/p3","share_with":null,"share_with_displayname":"(Geteilter Link)","password":null,"send_password_by_talk":false,"url":"http://xxx/index.php/s/Kw5qTZWcdXnN3Y5","mail_send":0,"hide_download":0}]}}