# FileService
WebService for administration of files on the file area and the project files.
The WebService is divided into two parts. FileService for uploading and downloading of files, and FileInfoService for information about categories and files.
FileService (opens new window)
FileService WSDL (opens new window)
FileInfoService (opens new window)
FileInfoService WSDL (opens new window)
# Guides
# Uploading a new file
In order to upload a new file, determin where the file should be located. For this the GetFolderContentInfo (opens new window) should be used to get e.g. the FolderId needed. To start a file upload call AppendChunk (opens new window). The response contains a tmpId that is used for the subsequent file chunk uploads. Once all the data have been transmitted, call the Save (opens new window) method with the tmpId and the FileInfo (filename, FolderId) to save the file.
# Updating a file
To update a file. Delete the file and then reupload it.
# Deleting a file
To delete a file, call the Delete (opens new window) method and specifying the FileId and the FolderId.
WARNING
Please note: The Delete methods requires administrator privileges. To get these rights contact our support at support@24SevenOffice.com
# Getting folder and file info
You use the GetFolderContentInfo (opens new window) method to get information about files and folders. The response will give you a FileId and a FolderId that is used when downloading files.
You have a number of search parameters available, e.g. Customers, Projects, Dates etc. The TypeOfResult parameter lets you choose if you want Files, Folders or All (both files and folders) in the response.
If you set FolderId to 0 you'll get the files and folders from the shared folder in the file module.
WARNING
Please note: When using the search parameters, ProjectId will take precedence over FolderId so these cannot be combined. First you would search for ProjectId information and then use the return data to get specific FolderId data without adding the ProjectId as a search parameter.
# Downloading files
Before downloading files you should have identified them through requests to GetFolderContentInfo (opens new window). This method will provide you with the FolderId and FileId that you need for downloading files. You can then make a request to PrepareFileDownload (opens new window) with the FolderId and FileId which will return a TmpId that you use for the actual download. If the file is large, now is a good time to get a refill on your coffee, this could take a while. Once you get a response with the TmpId you can proceed with the actual file download.
In order to download the file content you send a request to [DownloadFileChunk] with the TmpId and ChunckNum (Yes, ChunckNum is written wrong here, so if you're not using a SOAP framework and typing in all property names by hand, beware). Each chunk is 546533 bytes. You start by setting ChunckNum to 0 and then work your way up, so 0, 1, 2, 3 etc. Once a chunk is less than 546533 bytes you're at the end of the download. When you stitch together these parts you'll have a complete file on your end.
# Checking a file hash
When you have uploaded a new file, you can check the content of the file by using the HashFile (opens new window) method.
The HashFile (opens new window) requires a tempId which you get from the AppendChunk (opens new window) method.
Please note that this needs to be done before you use the Save (opens new window) method since the save will delete all temporary data.
# Methods
# FileService
Method | Input type | Return type | Description |
---|---|---|---|
GetMaxRequestLength (opens new window) | - | Long | Uploading |
AppendChunk (opens new window) | AppendChunk | String | Uploading |
AppendChunkByLength (opens new window) | AppendChunkByLength | String | Uploading |
Save (opens new window) | Save | Void | Save the appended file |
PrepareFileDownload (opens new window) | PrepareFileDownload | GetFileInfo | Downloading |
DownloadFileChunck (opens new window) | DownloadFileChunck | Byte[] | Downloading |
HashFile (opens new window) | HashFile | Byte[] | Uploading and Downloading |
EndFileDownload (opens new window) | EndFileDownload | Void | Downloading |
# FileInfoService
Method | Input type | Return type | Description |
---|---|---|---|
GetFolderContentInfo (opens new window) | Parameters | GetFolderContentInfoResult | Gets the location of the files/folders |
ReleaseFile (opens new window) | ReleaseFile | Boolean | |
Delete (opens new window) | Delete | Boolean | Deletes the specified file/folder |
GetFileInfo (opens new window) | GetFileInfo | File | |
FileSize (opens new window) | FileSize | Int |