- URL:https://<notebookserveradmin>/dataaccess/notebookworkspace/uploadFile(POST only)
- Required Capability:Administrator or Create and Edit ArcGIS Notebooks
- Version Introduced:10.9
Description
The uploadFile operation allows uploads a single file to your workspace directory (/arcgis/home). By default, the file is uploaded to the root of the workspace directory. You can prefix a directory path to the file name to upload the file to a subdirectory.
The upload file size limit is 128 MB for a single file. Large files can also be uploaded in parts from a client that has the ability to split files into smaller parts. To initiate a multipart upload, the client passes in the isMultipart=true parameter to the uploadFile operation, along with the fileName and blockId. After uploading all parts, the operation can be completed by passing in the xmlField along with fileName and isMultipart=true.
Request parameters
Parameter | Details |
---|---|
fileName (Required) | Defines the name of the file to be uploaded. Optionally, the file can be uploaded to a subdirectory by prefixing a folder path to the file name. If you upload a file using a fileName value that was used previously, the previously uploaded file is overwritten. Examples
|
uploadFile (Optional) | The file to be uploaded. This is required when uploading a single file or a file in multiple parts. This is not required when xmlField is specified to complete the upload of files in parts. |
isMultiPart (Optional) | A Boolean that is set to true if a large file is split into several parts and uploaded in smaller increments. The default value is false. Values: true | false |
blockId (Optional) | Required when uploading files in multiple parts. blockId can be either a number or an alphanumeric string. A blockId value uniquely identifies a part and defines its position in the object being created. If you upload a file using a blockId value that has been used previously, the previously uploaded part will be overwritten. Examples
|
xmlField (Optional) | Required to complete the upload of a large file in multiple parts. Once the individual parts have been uploaded, specify xmlField, fileName, and isMultiPart=truevalues to complete the upload. Otherwise, the files remain as individual parts.
|
x-ms-blob-type (Optional) | Required when uploading a single file or a file in multiple parts. This parameter is not required when xmlField is specified to complete the upload of files in parts. Value: BlockBlob |
f (Optional) | The response format. The default response format is html. Values: html | json | pjson |
Example usage
The following are example requests for uploadFile.
Example 1: Upload a single file to a folder
https://notebookserver.domain.com/context/admin/dataaccess/notebookworkspace/uploadFile
fileName = hydrology/mjwater.zip
uploadFile = <file>
x-ms-blob-type = BlockBlob
f = json
Example 2: Upload a file in parts
The following example usage demonstrates using uploadFile to upload a file in multiple parts.
Request 1: Upload part 1
https://notebookserver.domain.com/context/admin/dataaccess/notebookworkspace/uploadFile
fileName = mjwater.zip
uploadFile = <file>.part.001
isMultiPart = true
blockId = 0
x-ms-blob-type = BlockBlob
f = json
Request 2: Upload part 2
https://notebookserver.domain.com/context/admin/dataaccess/notebookworkspace/uploadFile
fileName = mjwater.zip
uploadFile = <file>.part.002
isMultiPart = true
blockId = 1
x-ms-blob-type = BlockBlob
f = json
Request 3: Complete upload
https://notebookserver.domain.com/context/admin/dataaccess/notebookworkspace/uploadFile
fileName = mjwater.zip
isMultiPart = true
uploadFile =
xmlField = <?xml version="1.0" encoding="utf-8"?> <BlockList> <Latest>1</Latest> <Latest>2</Latest></BlockList>
x-ms-blob-type = BlockBlob
f = json
JSON Response syntax
{"status": "<success|failure>"}
JSON Response example
{"status": "success"}