Update share by API don't work



owc: 10.0.7

I try to do:

curl --user XXX:XXX “https://www.mydomain.com/ocs/v1.php/apps/files_sharing/api/v1/shares/1” --request PUT --data ‘name=MY%20NEW%20NAME’

and I always receive:

<?xml version="1.0"?> failure 400 Wrong or no update parameter given

the share id exist. I would to change the name of the share folder.


I forsed the file Share20OCS.php to line 658, so the execution pass into “if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {”,
but despite this, the XML response correct:

<?xml version="1.0"?>

< ocs>
< meta>
< status>ok</ status>
< statuscode>100</ statuscode>
< message/>
</ meta>
< data>

but the share folder always have same name, it isn’t changed.


Fresh 10.0.7 installation with the default configuration works for me:

$ curl -X PUT -u admin:Password --data 'name=MY%20NEW%20NAME' http://server:port/ocs/v1.php/apps/files_sharing/api/v1/shares/1

<?xml version="1.0"?>
  <name>MY NEW NAME</name>

If you’ve modified the default configuration for sharing, a screenshot (if possible) would help to check in similar conditions.


I don’t change any configuration, I updated Share20OCS.php but only for a tried, now I put everything in place.
Also me the result is as you, only the share_type is 0 and not 3 (it’s for this I forsed the file Share20OCS.php).

<?xml version="1.0"?>
  <path>/try/MY OLD NAME</path>
  <file_target>/MY NEW NAME</file_target>
  <share_with_displayname>Bruno Rossi</share_with_displayname>

but in web browser and table oc_share I see MY OLD NAM, why?


The names are only applied for the links as is shown in the web UI. Shares with users or groups don’t have names.
What you’re trying to do is to rename the file. This is part of the wevDAV API not sharing.


But no, the share is (by /ocs/v1.php/apps/files_sharing/api/v1/shares):

[0] => SimpleXMLElement Object
[id] => 1490
[share_type] => 0
[uid_owner] => administrator
[displayname_owner] => Admin
[permissions] => 31
[stime] => 1470834860
[parent] => SimpleXMLElement Object

                                [expiration] => SimpleXMLElement Object

                                [token] => SimpleXMLElement Object

                                [uid_file_owner] => administrator
                                [displayname_file_owner] => Admin
                                [path] => /PATH/MY NEW NAME
                                [item_type] => folder
                                [mimetype] => httpd/unix-directory
                                [storage_id] => home::administrator
                                [storage] => 1
                                [item_source] => 3328
                                [file_source] => 3328
                                [file_parent] => 3325
                                [file_target] => /MY OLD NAME
                                [share_with] => mario.rossi
                                [share_with_displayname] => mario rossi
                                [share_with_additional_info] => SimpleXMLElement Object

                                [mail_send] => 0

I done the rename, in fact in path there is the new name, while in file_target I see the old name.