<uploadTasks_uri>/{taskID}[.<format>]
The file uploading task resource, created by the POST request of the uploadTasks resource, is used to execte the file uploading task and return the status of the uploading task, such as the percentage of the uploading progress. In which, the POST operation obeys the uploading file standard RFC1867 of HTTP.
Specific usage of uploadTask can refer to : JavaScript Sample Code (%SuperMap iServer_HOME%/sample/code/UseRESTAPI/FileUpload) or Java Sample Code (%SuperMap iServer_HOME%/sample/code/UseJavaAPI/FileUploadSample).
Supported Methods:
Supported output formats: rjson, json, xml.
Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.
http://supermapiserver:8090/iserver/manager/filemanager/uploadtasks/{taskID}.rjson
Gets the status of the uploading task, such as the percentage of the uploading progress.
Get the status information of the uploading file.
Field | Type | Description |
path | String | The target location of the uploading file in the current task, which is the name of the uploading file and the location. |
progress | double | The percentage of progress of the uploading file. |
md5 | String | The MD5 value of the uploading data. The value is sent to the server after calculation by the client, and it is used for verification after uploading. |
uploadedDataMD5 | String | The MD5 value of the data uploaded, valid when state is UPLOADING_ERROR. Used for verification for the client while resuming uploading after unexpected error. |
state | State | The task status. The value could be NEW|UPLOADING|COMPLETED|UPLOADING_ERROR|ERROR. |
uploadedByteCount | long | The uploaded number of bytes, valid when state is UPLOADING_ERROR. Used for verification for the client while resuming uploading after unexpected error. Upload resumption cannot be implemented if the value is null. |
Execute a GET request on the uploadTask resource to get status information of the uploading file:
http://localhost:8090/iserver/manager/filemanager/uploadtasks/5280c5e718a34667b4d39c9d8ab45dc5_b77784d9aa1a4d578a57b03900fda75d.rjson
The response result in rjson format returned is as follows:
{
"taskID": "5280c5e718a34667b4d39c9d8ab45dc5_b77784d9aa1a4d578a57b03900fda75d",
"path": "d:\test\test.sxwu",
"progress": "88.51",
"md5": null,
"uploadedDataMD5": null,
"state": "COMPLETED",
"uploadedByteCount": 0
}
Send a request to upload file, i.e., upload a file to the server.
URI contains the following parameters:
Name | Type | Description |
toFile | String | [Required parameter] The target location of the file to be uploaded, i.e., the file name of the uploading results and its location, like toFile=D:\test\test.udb. Both absolute path or relative path are OK. The starting position of relative path is the application directory of iServer. The postfix of the file should be consistent with that of the uploaded file. |
overwrite | boolean | [Optional parameter] Whether to overwrite a file of the same name. Default is false. |
unzip | boolean | [Optional parameter] Whether to unzip files to be uploaded. Invalid when the format of the file is *.zip. Default is false, i.e., not unzipped. If true and the uploaded file is in *.zip format, then the file will be uploaded into a specified location and be unzipped under a folder which has a same name with the uploaded file. This folder has a same storage location with *.zip. |
The request body contains the following parameters:
Name | Description |
file | Files need to be uploaded. |
The service returns verification information of the uploaded file, including the following fields:
Field | Type | Description |
fileName | String | Name of file or folder directory. |
filePath | String | The target file or directory after uploading a file, which can be denoted with an absolute path. The starting position of relative path is the application directory of iServer. |
fileSize | long | The size of the file for uploading, with the unit being bytes. |
isDirectory | boolean | Whether it is the directory, and the default is false. |
Executes the POST request on uploadTask, transfers the uploading file stream World.udb in the request body, and specifies a target location in URI to upload a file. In which, executing the POST operation in WebManager must transfer Token in URI. The request address is:
http://localhost:8090/iserver/manager/filemanager/uploadtasks/5280c5e718a34667b4d39c9d8ab45dc5_b77784d9aa1a4d578a57b03900fda75d.rjson?&toFile=d:\test\test.udb&token=3XjSGlFx4KN5MMUHSsekOxJvxgPimVxPWSKIsfL9Qtlwx0nW0gEc8qY8B44tnVVEBQq-nPs2DUKenmDBFhCuYw..
For specific usage of uploadTask, you can refer to Sample Code at iServer_HOME%/sample/code/UseRESTAPI/FileUpload.
The returned result in rjson format is as follows:
{
"fileName": "test.sxwu",
"filePath": "d:\test\test.sxwu",
"fileSize": "22970384",
"isDirectory": "False"
}
Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.
HEAD request can be used to check if the uploadTask resource exists, or if the uploadTask resource can be accessed by clients. It can also determine if the uploadTask resource supports an output format <format> if performed on a URI with .<format> included.