Share file API - Share via link
OVERVIEW
Purpose
This api method is used to share content (file or folder) from "my files" or "shared items"
Request URL
POST /shares/link
Request Body
Parameter | Type | Description |
---|---|---|
resourcetype | String | The type of the resource which is to be shared. This is a text field with two possible entries "folder" or "file" |
resourceid | int | The Id of the resource to share. The resource ID can be obtained by using the file or folder information methods |
permissions | int |
There are two possible options 1 = Download, view or print 2 = View only |
shareoption | int |
There are three possible options which governs who can use this share 1 = anyone 2 = my organisation user 3 = system users |
expiry | date | This is the UTC date and time when this share will expire |
<share>
<resourcetype>folder/file</resourcetype> {folder/file}
<resourceid>integer content id</resourceid> (the id can be any from my files or shared items)
<permissions> integer value for the two options </permissions> {1(download_view_print) / 2(view_only)}
<shareoption> integer value for the options </shareoption> {1(anyone) / 2(my organisation user) / 3(system users /4(Can be accessed by anyone who has the password) this 4th option is introduced from API version 6 onwards for sharing password protected files})}
<password>12345</password> {This option is only used from API version 6 onwards when the shareoption value is 4}
<expiry>UTC date and time(dd MMM yyyy HH:mm)</expiry>
<share>
All fields in the request body are mandatory.
Sample request xml :
<share>
<resourcetype>file</resourcetype>
<resourceid>53</resourceid>
<permissions>1</permissions>
<shareoption>1</shareoption>
<expiry>09 Dec 2014 13:54</expiry>
</share>
Sample request xml for sharing password protected file (api version 6 onwards):
<share>
<resourcetype>file</resourcetype>
<resourceid>53</resourceid>
<permissions>1</permissions>
<shareoption>4</shareoption>
<expiry>09 Dec 2014 13:54</expiry>
<password>12345</password>
</share>
Response XML
Field | Type | Description |
---|---|---|
shareid | int | ID of the newly created share |
resourcename | String | The name of the item that has been shared |
link | string | The link to the shared resource, this can be used in an email or any other way of distributing the share with the required personal. |
<share>
<shareid>85</shareid>
<resourcename>Quick16.png</resourcename>
<link>https://ankitjava.local.com/ankit_3_4_1/viewSharedContent.action?linkParam=nkZuZK5FIto=</link>
</share>
Response Codes
Code | Meaning |
---|---|
200 | Response successfully |
401 | Unauthorized |
403 | Validation failed/ Forbidden |
405 | Method not allowed (calling api with wrong method) |
500 | Internal error occured while uploading document |
Comments
0 Comments