Use this operation to share a specific file or folder in an ObjectStore based on the file or folder path.
Request
Syntax
POST <webservice>/contentstore/action/share HTTP/1.1
Host: <host name>
Accept: application/xml
Authtoken: <authentication token>
Content-type: application/xml
<App_ShareInfo status="">
<browseInfo>
<paths path="" />
<emailInfo dontSendEmail="0" emailMessage=""/>
<password isSet="" password=""/>
</browseInfo>
<shareFolder syncWebFolderName=""/>
<sharedTo permission="1" userType="1">
<user userName=""/>
</sharedTo>
<sharedTo email="" permission="1" userType="2"/>
<sharedTo permission="2" userType="3">
<group userGroupName=""/>
</sharedTo>
<sharedTo email="" permission="1" userType="4">
<externalGroup externalGroupName=""/>
</sharedTo>
<sharedTo permission="1" userType="1">
<user userName=""/>
</sharedTo>
</App_ShareInfo>
where <webservice> is the root path used to route the API requests to the Web Server.
For more information, see Available Web Services for REST API.
Request Headers
Name |
Description |
Host |
The host name of the Web Server or Web Console used in the API request. |
Accept |
The format of the response. Valid values are: application/xml or application/json. |
Authtoken |
The authentication token received after successfully logging on. For details on receiving an authentication token, see Authentication. |
Request Body
An XML element is required. See Syntax. The following table displays the parameters for the request body.
Name |
Description |
Element |
Parent Element |
status |
Specifies whether the share will be a public share or a private share. Valid values are:
|
App_ShareInfo |
|
path |
The path to the file or folder to be shared. Specify the path relative from the root. |
paths |
browseInfo |
syncWebFolderName |
The name assigned to the share. |
shareFolder |
App_ShareInfo |
dontSendEmail |
Specifies whether an email notification is sent to the shared users. Valid values are:
|
emailInfo |
browseInfo |
emailMessage |
The optional message to include in the email notification for the shared users. |
emailInfo |
browseInfo |
isSet |
Applies only to public links. Specifies if the public link must be password protected. To enable password, set the value to 1. |
password |
browseInfo |
password |
The password value in base64 format. Required only if the isSet parameter is 1. |
password |
browseInfo |
permission |
Applies only to private shares. The access permissions assigned to the shared user or user group. Valid values are:
|
sharedTo |
App_ShareInfo |
userType |
Applies only to private shares. Specifies the type of entity to which the file or folder is being shared. Valid values are:
|
sharedTo |
App_ShareInfo |
userName |
Applies only to private shares. The user login name to which the file or folder is being shared. Required only if the userType is 1. |
user |
sharedTo |
|
Applies only to private shares. The email address to which the file or folder will be shared. Required only if the userType is 2. |
sharedTo |
App_ShareInfo |
userGroupName |
Applies only to private shares. The CommCell user group name to which the file or folder will be shared. Required only if the userType is 3. |
group |
sharedTo |
externalGroupname |
Applies only to private shares. The external AD user group name to which the file or folder will be shared. Required only if the userType is 4. |
externalGroup |
sharedTo |
Response
Response Parameters
Parameter |
Description |
Element |
file |
'file=1' indicates the shared item is a file. |
App_SharedFoldersResp |
directory |
'directory=1' indicates the request item is a folder. |
App_SharedFoldersResp |
path |
GUID of the shared file or folder. |
App_SharedFoldersResp |
dontSendEmail |
Specifies whether an email notification is sent to the shared users. Valid values are:
|
App_SharedFoldersResp |
emailMessage |
The optional message to include in the email notification for the shared users. |
App_SharedFoldersResp |
syncWebFolderId |
The ID assigned to the share. |
App_SharedFoldersResp |
syncWebFolderName |
The name assigned to the share. |
App_SharedFoldersResp |
Examples
Sample Request
To create a private share:
POST <webservice>/contentstore/action/share HTTP/1.1
Host: client1.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: application/xml
<App_ShareInfo sharedToOperationType="2" status="0">
<browseInfo>
<paths path="\folder1"
<emailInfo dontSendEmail="1" emailMessage=""/>
</browseInfo>
<shareFolder syncWebFolderName="fromlaptop"/>
<sharedTo permission="1" userType="1">
<user userName="user1"/>
</sharedTo>
</App_ShareInfo>
To create a public link with view permissions:
POST <webservice>/contentstore/action/share HTTP/1.1
Host: client1.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
Content-type: application/xml
<App_ShareInfo sharedToOperationType="2" status="1"> <browseInfo> <paths path="\folder1" <emailInfo dontSendEmail="1" emailMessage=""/> <password isSet="1" password="bXlwYXNzd29yZA=="/> </browseInfo> <shareFolder syncWebFolderName="fromlaptop"/>
</App_ShareInfo>
Sample Response
<App_SharedFoldersResp>
<shareInfo>
<browseInfo cloudId="1" edgeClient="1">
<paths directory="1" path="7c4e538afe864e25ae415357aa6fa04e"" />
<emailInfo dontSendEmail="1" emailMessage="" />
</browseInfo>
<shareFolder syncWebFolderName="Test" syncWebFolderId="36" />
</shareInfo>
<resp errorMessage="" errorCode="0" />
</App_SharedFoldersResp>
Supported Error Codes
Code |
Status |
Description |
---|---|---|
400 |
Bad Request |
The request is missing required parameters. |
404 |
Not Found |
The specified file or folder does not exist. |
409 |
Conflict |
The file or folder is already shared or the specified share name already exists. The response body will have the shareID of the existing share if the file or folder is already shared. The shareID can be used to update the users/user groups to which the file or folder is already shared. For example: <App_SharedFoldersResp> <shareInfo> <shareFolder syncWebFolderName="Test" syncWebFolderId="10" /> </shareInfo> <resp errorMessage="" errorCode="409" /> </App_SharedFoldersResp> |