Folders API
Actions supported by the Folders API
Action: create
This action is for creating and setting up a folder on the server. It's possible to create a completely new folder or let the server sync a folder which already exists on a client or on a different server (by folder ID).
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "create" | create |
name | Yes | The name of the folder | Sales Material |
ID | No | The ID of the folder. Will take the existing folder with that ID if available. | [PME2myosRegfgKk8m0YdIA] |
path | No | The physical path to store the folder to. The calling user requires admin permission. | D:\Data\Sales Material |
serverID | No | The ID of the server in cluster the folder will be created on. If omitted the server which received the request will be used. | 6bzY8niQKaNEg7xGnog |
Example
https://powerfolder.example.com/api/folders?action=create&name=Sales%20Material&path=D%3A%5CData%5CSales%20Material
{ "ID":"[PME2myosRegfgKk8m0YdIA]", "message":"Successfully created folder Sales Material" }
Action: delete
This action is for deleting a folder and removing all user's permissions from it.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "delete" | delete |
name | No | The name of the folder | Sales Material |
deleteData | No | 1 or 0. If the data should be physically deleted on disk. Yes by default. | 1 |
ID | Yes | The ID of an existing folder. | [PME2myosRegfgKk8m0YdIA] |
Example
https://powerfolder.example.com/api/folders?action=delete&ID=%5BPME2myosRegfgKk8m0YdIA%5D
{ "ID":"[PME2myosRegfgKk8m0YdIA]", "message":"Successfully deleted folder Sales Material. Removed 3 members." }
Action: setPermission
This action is for adding and removing users to/from a folder. With this method it is also possible to change access permission of users on folders. Does NOT sent an invitation E-Mail!
Make sure to URL-encode the parameter values.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "setPermission" | setPermission |
ID | Yes | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
name | No | The name of the folder.If two folders with the same name exists, e.g. "Documents", PowerFolder will use only one of those folders. Therefore it is recommend to pass the unique folder "ID" to distinguish the folders. | Sales Material |
username | Yes | The existing username/email to apply the permissions to. | user@example.com |
createAccount | No | Sould a new account be created if it not yet exists? | 1 |
permission | Yes | The permission to set. Must be one of these values: NO_ACCESS, READ, READ_WRITE, ADMIN or OWNER | READ |
Example
https://powerfolder.example.com/api/folders?action=setPermission&username=user%40example.com&ID=%5BPME2myosRegfgKk8m0YdIA%5D&permission=READ
{ "message":"Set new permission for user@example.com on Sales Material to READ", "ID":"[PME2myosRegfgKk8m0YdIA]" }
Action: invite
Since 11.2
This action invites a user to a folder. An invitation E-Mail is sent to the user.
Make sure to URL-encode the parameter values.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "invite" | invite |
ID | Yes | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
username | Yes | The existing username/email of the user to invite | user@example.com |
createAccount | No | Sould a new account be created if it not yet exists? | 1 |
permission | Yes | The permission to be set. Must be one of the following: READ, READ_WRITE, ADMIN or OWNER | READ |
Example
https://powerfolder.example.com/api/folders?action=invite&username=user%40example.com&ID=%5BPME2myosRegfgKk8m0YdIA%5D&permission=READ
{ "message":"Send invite to user@example.com for Sales Material to grant READ", "ID":"[PME2myosRegfgKk8m0YdIA]" }
Action: getInfo
This action returns some general information about a folder.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "getInfo" | getInfo |
ID | Yes | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
Example
https://powerfolder.example.com/api/folders?action=getInfo&ID=%5BPME2myosRegfgKk8m0YdIA%5D
If there is no Link to the folder, the values "link" and "isPublic" are not returned. You can create a Link using the File Link API.
{ "ID":"[PME2myosRegfgKk8m0YdIA]", "name":"Sales Documents", "basePath":"/storage/Sales Documents", "link":"https://powerfolder.example.com/getlink/fiVej3G7AL553BthR8FJyoVK/", "isPublic":true }
Action: getAccounts
This action returns all users accounts of a folder.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "getAccounts" | getAccounts |
ID | Yes | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
name | No | The name of the folder. For logging purposes. | Sales Material |
Example
https://powerfolder.example.com/api/folders?action=getAccounts&ID=%5BPME2myosRegfgKk8m0YdIA%5D
{ "ResultSet":{ "Result":[ { "ID":"3GYXgyusXuNoHd88qgWp", "username":"manager@example.com", "permission":"OWNER" }, { "ID":"Tb2yMiAx3CuRrqMeccHh", "username":"employee@example.com", "permission":"ADMIN" }, { "ID":"Xr2Ajd235MeccHh", "username":"customer@example.net", "permission":"READ" } ] } }
Result key | Description | Example |
---|---|---|
ID | Account ID | 3GYXgyusXuNoHd88qgWp |
username | Account username | user@example.com |
permission | The permission on the folder. NO_ACCESS, READ, READ_WRITE, ADMIN or OWNER | READ_WRITE |
Action: removeAllAccounts
This action will remove all users from a folder, by revoking their access permissions including the owner. It will not remove the folder itself.
Make sure to URL-encode the parameter values.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "removeAllAccounts" | removeAllAccounts |
ID | Yes | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
name | No | The name of the folder. For logging purposes. | Sales Material |
Example
https://powerfolder.example.com/api/folders?action=removeAllAccounts&ID=%5BPME2myosRegfgKk8m0YdIA%5D
{ "message":"Revoked all permissions for 3 users on folder Sales Material", "ID":"[PME2myosRegfgKk8m0YdIA]" }
Action: rename
This action will rename a Folder specified by its ID to the given name.
Make sure to URL-encode the parameter values.
Parameter | Mandatory | Description | Example |
---|---|---|---|
action | Yes | Must always be "rename" | rename |
ID | Yes | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
newName | Yes | The new name of the folder. | Sales Material |
Example
https://powerfolder.example.com/api/folders?action=rename&ID=%5BPME2myosRegfgKk8m0YdIA%5D&newName=Sales%20Material
Return Value
{ "message":"Folder successfully renamed", "newName":"Sales Material" }