Upload File

URL:
https://<notebookserveradmin>/dataaccess/notebookworkspace/uploadFile
Methods:
POST
Required Capability:
Administrator or Create and Edit
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

ParameterDetails

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

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
//Example 1: Upload a file to the root directory in the user's workspace
fileName=mjwaterzip

//Example 2: Upload a file to a subdirectory () in the user's workspace
fileName=hydrology/mjwaterzip

//Example 3: Upload a file to a nested subdirectory in the user's workspace
fileName=hydrology/2020/mjwaterzip

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

Use dark colors for code blocksCopy
1
2
3
blockId=0

blockId=a0

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=true values to complete the upload. Otherwise, the files remain as individual parts.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
Example: A large file uploaded in five individual parts with  0 to 4<?xml version="1.0" encoding="utf-8"?>
<BlockList>
<Latest>0</Latest>
<Latest>1</Latest>
<Latest>2</Latest>
<Latest>3</Latest>
<Latest>4</Latest>
</BlockList>

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

Use dark colors for code blocksCopy
1
2
3
4
5
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

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
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

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
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

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
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

Use dark colors for code blocksCopy
1
{"status": "<success|failure>"}

JSON Response example

Use dark colors for code blocksCopy
1
{"status": "success"}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.