Folders API
Contents |
Preface
The folders API is designed to create, remove, setup folders. It's also possible to change the access permissions of users to folders. Please read the general API documentation for a general understanding of the PowerFolder API.
Web URL
The service is reachable at the URI: /api/folders
Example: http://myserver.com/api/folders
Authorization / Security
Calls of the API always require an authorized caller. This is done by basic access authorization which must be added to each call. Depending on the service and action it's required to authenticate with a regular user or admin.
Action: create
This action is for creating and setting up a folder at the server/cloud. It's possible to create a completely new folder or let the server/cloud sync a folder, which already exists on a client or 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
Return value
{
"ID":"[PME2myosRegfgKk8m0YdIA]",
"message":"Successfully created folder Sales material"
}
Action: delete
This action is for deleting a folder and remove all users from it.
| Parameter | Mandatory | Description | Example |
|---|---|---|---|
| action | Yes | Must always be "delete" | delete |
| name | No | The name of the folder | Sales material |
| ID | Yes | The ID of an existing folder. | [PME2myosRegfgKk8m0YdIA] |
Example
http://myserver.com:8080/api/folders?action=delete&ID=%5BPME2myosRegfgKk8m0YdIA%5D
Return value
{
"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. Note: Make sure to URL-encode the parameter values.
| Parameter | Mandatory | Description | Example |
|---|---|---|---|
| action | Yes | Must always be "setPermission" | setPermission |
| ID | Yes, if "name" not set | The ID of the folder. | [PME2myosRegfgKk8m0YdIA] |
| name | Yes, if "ID" not set | 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@myserver.com |
| createAccount | No | If an new account should be created if not existing and LDAP/AD policies allow it. | 1 |
| permission | Yes | The permission to set. Must be one of these values: NO_ACCESS, READ, READ_WRITE, ADMIN or OWNER | READ |
Example
Return value
{
"message":"Set new permission for user@myserver.com on Sales material to READ",
"ID":"[PME2myosRegfgKk8m0YdIA]"
}
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
http://myserver.com:8080/api/folders?action=getAccounts&ID=%5BPME2myosRegfgKk8m0YdIA%5D
Return value
{
"ResultSet":{
"Result":[
{
"ID":"3GYXgyusXuNoHd88qgWp",
"username":"manager@company.com",
"permission":"OWNER"
},
{
"ID":"Tb2yMiAx3CuRrqMeccHh",
"username":"employee@company.com",
"permission":"ADMIN"
},
{
"ID":"Xr2Ajd235MeccHh",
"username":"customer@thirdparty.de",
"permission":"READ"
}
]
}
}
| Result key | Description | Example |
|---|---|---|
| ID | Account ID | 3GYXgyusXuNoHd88qgWp |
| username | Account username | user@company.de |
| 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. Note: 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
http://myserver.com:8080/api/folders?action=removeAllAccounts&ID=%5BPME2myosRegfgKk8m0YdIA%5D
Return value
{
"message":"Revoked all permissions for 3 users on folder Sales material",
"ID":"[PME2myosRegfgKk8m0YdIA]"
}