跳到主要内容

setFileSecurityInfo

FileShareArrayWrapper setFileSecurityInfo(id, SecurityInfoSimpleRequestDto)

PUT /api/2.0/files/file/{id}/share

Share a file

Grants, changes or withdraws the rights of the listed accounts and groups on one file, and answers with the rights those subjects hold afterwards. Every element of share names a subject and the level it is to get, and the level that denies everything takes the access away instead; an empty share changes nothing and is answered with an empty list. A subject the caller is not allowed to share with, such as a guest who belongs to another member, is dropped without an error, so compare the answer with what was sent. With notify set, each account named is emailed about the access it received and sharingMessage is put into that mail with its markup stripped, while a message longer than the field allows is rejected as an invalid request. The caller has to be allowed to change the sharing of the file, which its creator, the manager of the room it lies in and a portal administrator acting as room manager are; anyone else, a guest and a member with read access included, is refused. The call is mutating and safe to repeat. For several files and folders in one request use PUT api/2.0/files/share.

Parameters​

NameInTypeDescriptionNotes
idpathInteger (int32)The file whose sharing is being changed. A file stored on the portal is numbered, while a file in a connected third-party account is named by an opaque string.[required] [example: 10]
SecurityInfoSimpleRequestDtobodySecurityInfoSimpleRequestDtoThe rights to apply to the file, and whether to announce them by mail.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The rights the listed subjects hold on the file after the changeFileShareArrayWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The request body cannot be read, an email in share is malformed or longer than 255 characters, share invites more addresses by email than the portal allows at once, or sharingMessage is longer than 255 characters--
403The caller may not change the sharing of the file, or a listed subject cannot be given the requested access on it--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

FileShareArrayWrapper

Third-party storage​

For a file or folder in a connected third-party storage the identifier is a string such as sbox-42, and the call differs in these parts only:

NameInTypeDescriptionNotes
idpathStringThe file whose sharing is being changed. A file stored on the portal is numbered, while a file in a connected third-party account is named by an opaque string.[required] [example: sbox-42-L1JlcG9ydC5kb2N4]

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json