OCS Share API Permissions dont work


I try to create a share with the following:

curl --user “admin:PASSWORD” “https://DOMAIN/ocs/v1.php/apps/files_sharing/api/v1/shares” --data ‘path=/Test’ --data ‘shareType=3’ --data ‘name=welcome.txt’ --data ‘permissions=31’

The response I get:

Updating via PUT gives me:

  <message>Can't change permissions for public share links</message>

Nextcloud also has this bug, I hoped you guys at least dont. Or is there something wrong with the request?


There is no bug at all, it’s your request. You shouldn’t accuse others.

It works like a charm.

$ curl -n -X POST https://domain/ocs/v1.php/apps/files_sharing/api/v1/shares --data 'name=welcome.txt' --data 'path=/Test/welcome.txt' --data 'shareType=3' --data 'permissions=31'
<?xml version="1.0"?>
  <displayname_owner>Alfred Bühler</displayname_owner>
  <displayname_file_owner>Alfred Bühler</displayname_file_owner>

BTW, setting permission 31 for public links is superfluous, as it will be ignored and permission 1 will be applied.

1 Like

I am sorry, I had a bad day. I will check it, thank you so much. I tried your request but it isnt working for me, still permission 1. But thanks anyway.

Tell me more details, please.