PUT api/2.0/files/file/{fileId}/share This function requires authentication

Description

Sets the sharing settings to a file with the ID specified in the request.

Parameters
Name Description Type Example
fileId
sent in url
File ID string some text
share
sent in body
Collection of sharing parameters Collection of ASC.Api.Documents.FileShareParamss
collection
notify
sent in body
Notifies users about the shared file or not Bool value true
sharingMessage
sent in body
Message to send when notifying about the shared file string some text
advancedSettings
sent in body
Advanced settings which prohibit printing, downloading, copying the file, and changing sharing settings ASC.Web.Files.Services.WCFService.AceAdvancedSettingsWrapper
Remark

Each of the sharing parameters must contain two values: "ShareTo" - ID of the user with whom we want to share a file, "Access" - access type which we want to give to the user (Read, ReadWrite, etc).

Example
PUT api/2.0/files/file/%22some+text%22/share
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json

{
  "share": [
    {
      "shareTo": "2fdfe577-3c26-4736-9df9-b5a683bb8520",
      "access": "0"
    }
  ],
  "notify": true,
  "sharingMessage": "some text",
  "advancedSettings": null
}
Returns

Shared file information

Example Response

application/json

{
  "status": 0,
  "response": [
    {
      "Access": 1,
      "SharedTo": {
        "id": "00000000-0000-0000-0000-000000000000",
        "displayName": "Mike Zanyatski",
        "title": "Manager",
        "avatarSmall": "url to small avatar",
        "profileUrl": ""
      },
      "IsLocked": false,
      "IsOwner": true
    }
  ]
}

text/xml

<result>
  <status>0</status>
  <response>
    <Access>1</Access>
    <SharedTo>
      <id>00000000-0000-0000-0000-000000000000</id>
      <displayName>Mike Zanyatski</displayName>
      <title>Manager</title>
      <avatarSmall>url to small avatar</avatarSmall>
      <profileUrl />
    </SharedTo>
    <IsLocked>False</IsLocked>
    <IsOwner>True</IsOwner>
  </response>
</result>