Skip to content

Commit 5c8c1ff

Browse files
authored
Merge pull request #9520 from nextcloud/backport/9518/stable24
[stable24] Add share attributes documentation in OCS Share API
2 parents 1a25140 + cc787de commit 5c8c1ff

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

developer_manual/client_apis/OCS/ocs-share-api.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Share a file/folder with a user/group or as public link.
8484
* POST Arguments: expireDate - (string) set a expire date for public link
8585
shares. This argument expects a well formatted date string, e.g. 'YYYY-MM-DD'
8686
* POST Arguments: note - (string) Adds a note for the share recipient.
87+
* POST Arguments: attributes - (string) URI-encoded serialized JSON string for :ref:`share attributes<Share attributes>`
8788
* Mandatory fields: shareType, path and shareWith for shareType 0 or 1.
8889

8990
* Result: XML containing the share ID (int) of the newly created share
@@ -127,6 +128,7 @@ Update a given share. Only one value can be updated per request.
127128
* PUT Arguments: expireDate - (string) set a expire date for public link
128129
shares. This argument expects a well formatted date string, e.g. 'YYYY-MM-DD'
129130
* PUT Arguments: note - (string) Adds a note for the share recipient.
131+
* PUT Arguments: attributes - (string) serialized JSON string for :ref:`share attributes<Share attributes>`
130132

131133
.. note:: Only one of the update parameters can be specified at once.
132134

@@ -137,6 +139,29 @@ Statuscodes:
137139
* 403 - public upload disabled by the admin
138140
* 404 - couldn't update share
139141

142+
.. _Share attributes:
143+
144+
Share attributes
145+
^^^^^^^^^^^^^^^^
146+
147+
Share attributes are used for more advanced flags like permissions.
148+
149+
To remove the download permission from a share, use the following serialized string in the "attributes" parameter:
150+
151+
.. code-block:: json
152+
153+
[
154+
{"scope":"permissions","key":"download","enabled":false}
155+
]
156+
157+
This will prevent users from downloading the files from the share.
158+
For specific file types like office files, it will still be possible to view the files using the appropriate viewer app,
159+
which itself will present the file in a way that downloading will not be allowed.
160+
161+
By default when unset, the "download" attribute will be true and so the download permission will be granted.
162+
163+
.. note:: There is currently only one share attribute "download" from the scope "permissions".
164+
This attribute is only valid for user and group shares, not for public link shares.
140165

141166
Federated Cloud Shares
142167
----------------------

0 commit comments

Comments
 (0)