The methods listed below cover getting list of files and folders, creating new folders, renaming and deleting items. Uploading new files, however, is described in a separate section.
Files
Retrieving list of files in specific folder.
Request Item | Type | Sample value | Description |
AccountID | int | 1 | ID of account |
Action | string | "Files" | |
AuthToken | string | "89e307c653d701c17d61f2f116dba618” | string obtained with SystemLogin. Not needed if client supports cookies. |
Path | string | "" | If empty, root list is returned. To obtain list of files in folder, specify FullPath property value this request returns. |
Pattern | string | "" | optional |
Type | string | "personal" or "corporate" | |
Token | string | "169874786e1d429e20fd993800a8c08c" | |
Sample response:
{
"Action":"Files",
"AccountID":1,
"Result":
{
"Items":
[
{
"@Object":"Object\/CFileStorageItem",
"Id":"111",
"Type":"personal",
"Path":"",
"FullPath":"\/111", // path used for requesting subfolder contents
"Name":"111",
"Size":0,
"IsFolder":true, // true for folder, false for file
"IsLink":false,
"LinkType":0,
"LinkUrl":"",
"LastModified":0,
"ContentType":"",
"Iframed":false,
"Thumb":false,
"ThumbnailLink":"",
"OembedHtml":"",
"Hash":"",
"Shared":false,
"Owner":"user@domain.com",
"Content":"",
"IsExternal":false
},
{
"@Object":"Object\/CFileStorageItem",
"Id":"logo-twitter_0.png",
"Type":"personal",
"Path":"",
"FullPath":"\/logo-twitter_0.png",
"Name":"logo-twitter_0.png",
"Size":3014,
"IsFolder":false,
"IsLink":false,
"LinkType":0,
"LinkUrl":"",
"LastModified":1434702113,
"ContentType":"image\/png",
"Iframed":false,
"Thumb":true,
"ThumbnailLink":"",
"OembedHtml":"",
"Hash":"rmax184WDndgKsZVDBKKUP6ODW6hv29XVfglUFMi3mmBvhq_EqYuIgS4PsoJ68TwJErgzWNMGTPlfVPJi2egLDstSdtqQR5xNX7HNqpLtGfdGKZpWDP0H9TVOJzol-F16eX6app74G9DkLUU10vv_PycHCkBdFVHi2dhW26l3-Rtr7WjgOnVZI7I8jIqeZrZEVrArfipeOSp1Tzr4leq6H4RUDxJ1A0CwAua24uIJrZFLdiE1R5NJrOhGaxD-j9QfCAyIX8d-Rk.",
"Shared":false,
"Owner":"user@domain.com",
"Content":"",
"IsExternal":false
}
],
"Quota":[2097152,-2097152]
},
"@Time":1.774092912674
}
Hash is used in links for downloading file, and for viewing it if specific file type is supported. If Hash is empty, it's a folder.
Download link format: '?/Raw/FilesDownload/' + AccountID + '/' + Hash
File view link format: '?/Raw/FilesView/' + AccountID + '/' + Hash
In case if you're not using web browser and cookies are unavailable, a different approach needs to be used for getting view/download links. It involves AuthToken value returned by SystemLogin call.
Download link format: '?/Raw/FilesDownload/' + AccountID + '/' + Hash + '/0/hash/' + AuthToken
File view link format: '?/Raw/FilesView/' + AccountID + '/' + Hash + '/0/hash/' + AuthToken
FileInfo
Retrieving path and other information on the file in specific folder.
Request Item | Type | Sample value | Description |
AccountID | int | 1 | ID of account |
Action | string | "FileInfo" | |
AuthToken | string | "89e307c653d701c17d61f2f116dba618” | string obtained with SystemLogin. Not needed if client supports cookies. |
Path | string | "" | Directory path the file was uploaded to. |
Name | string | "" | Name of file |
Type | string | "personal" or "corporate" | |
Token | string | "169874786e1d429e20fd993800a8c08c" | |
Sample response:
{
"Action":"FileInfo",
"AccountID":1,
"Result":
"Result": {
"@Object": "Object/CFileStorageItem",
"Id": "",
"Type": "personal",
"Path": "/",
"FullPath": "",
"Name": "9ynuq3LLFa4.jpg",
"Size": 0,
"IsFolder": false,
"IsLink": false,
"LinkType": 0,
"LinkUrl": "",
"LastModified": 0,
"ContentType": "",
"Iframed": false,
"Thumb": false,
"ThumbnailLink": "",
"OembedHtml": "",
"Hash": "",
"Shared": false,
"Owner": "test1@local.host",
"Content": "",
"IsExternal": false
},
"@Time":1.774092912674
}
Download and view links are generated the same way it's done upon obtaining files list with Files method.
FilesFolderCreate
Creating a new folder.
Request Item | Type | Sample value | Description |
AccountID | int | 1 | ID of account |
Action | string | "FilesFolderCreate" | |
AuthToken | string | "89e307c653d701c17d61f2f116dba618” | string obtained with SystemLogin. Not needed if client supports cookies. |
FolderName | string | "new folder" | Name of the folder to be created. |
Path | string | "" | If empty, folder is created in root. To create a subfolder, provide parent folder name by specifying FullPath property value Files request returns. |
Type | string | "personal" or "corporate" | |
Token | string | "169874786e1d429e20fd993800a8c08c" | |
Sample response:
{
"Action":"FilesFolderCreate",
"AccountID":1,
"Result":true,
"@Time":0.21366477012634
}
FilesRename
Renaming file or folder.
Request Item | Type | Sample value | Description |
AccountID | int | 1 | ID of account |
Action | string | "FilesRename" | |
AuthToken | string | "89e307c653d701c17d61f2f116dba618” | string obtained with SystemLogin. Not needed if client supports cookies. |
IsLink | int | 0 | optional |
Name | string | "file1.png" | Current name of file or folder. |
NewName | string | "file2.png" | New name of file or folder. |
Path | string | "" | If empty, file or folder is renamed in root. Otherwise, it denotes FullPath property value Files request returns. |
Type | string | "personal" or "corporate" | |
Token | string | "169874786e1d429e20fd993800a8c08c" | |
Sample response:
{
"Action":"FilesRename",
"AccountID":1,
"Result":true,
"@Time":0.21366477012634
}
FilesDelete
Removing file or folder.
Request Item | Type | Sample value | Description |
AccountID | int | 1 | ID of account |
Action | string | "FilesDelete" | |
AuthToken | string | "89e307c653d701c17d61f2f116dba618” | string obtained with SystemLogin. Not needed if client supports cookies. |
Items | string | [{"Path":"/my folder","Name":"file1.png"},{"Path":"/my folder/folder1","Name":"file2.png"},{"Path":"/my folder","Name":"folder2"}] | List of files and folders to delete. The list contains objects with Path and Name fields. |
Path | string | "" | If empty, files and folders are removed under root. Otherwise, it denotes FullPath property value Files request returns. |
Type | string | "personal" or "corporate" | |
Token | string | "169874786e1d429e20fd993800a8c08c" | |
Sample response:
{
"Action":"FilesDelete",
"AccountID":1,
"Result":true,
"@Time":0.21366477012634
}