API: Create web links on files and folders
| Target URL | /api.php/Drive/files/weblink |
| Required scope | weblink |
| HTTP Method | POST |
| Output format | JSON |
Request Parameters Reference
| Parameter | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | The FileRun path of the target file, folder or collection. See this page |
| role | string | No | One of the following: viewer (the default), commenter, editor, uploader. uploader can be used only with folders. editor requires that the account may edit the item, commenter that it may read metadata or comments. |
| password | string | No | The password must satisfy the password policy of the installation. |
| expiry | string | No | MySQL datetime format Y-m-d H:i:s, or a date as Y-m-d. |
| download_limit | integer | No | The maximum number of downloads. Only for links which point to a file. Send an empty value to remove a limit. |
| download_terms | string | No | Terms the visitor has to accept before downloading. |
| require_login | boolean (1/0) | No | Only logged in FileRun users will be able to access the link. |
A parameter which is not in this list is refused ("Bad request, unknown option ..."). When the item already has a web link, its settings are updated with the values sent.
Example reply:
1{
2 "success": true,
3 "msg": ["..."],
4 "status": "created", //can also return "updated",
5 "url": "https:\/\/www.yoursite.com\/wl\/?id=CtmsT8IWoen3JDZIVbxvR3SH45gvvvxs"
6}