Skip to content

Upload File

URL:
https://dataaccess/notebookworkspace/uploadFile
Methods:
POST
Required Capability:
Access allowed with the "Create and edit notebooks" privilege
Version Introduced:
11.5

Description

The uploadFile operation allows uploads of 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 parameter as true, along with the fileName and blockId parameters. After uploading all parts, the operation can be completed by passing in the xmlField and fileName parameters, as well as the isMultipart parameter set as true.

Request parameters

ParameterDetails

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.

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.

Example
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

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. The blockId value 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.

Example
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 values for the xmlField, fileName, and isMultiPart (set as true) parameters to complete the upload. Otherwise, the files remain as individual parts.

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

The response format. The default response format is html.

Values: html | json | pjson

Example usage

The following are example requests for the uploadFile operation.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
POST /<context>/notebooks/admin/dataaccess/notebookworkspace/uploadFile
Host: organization.domain.com
Content-Type: multipart/form-data; boundary=------boundary

------boundary
Content-Disposition: form-data; name="uploadFile"; filename=""
Content-Type: application/octet-stream

mjwater.zip
------boundary
Content-Disposition: form-data; name="fileName"

mjwaterzip
------boundary
Content-Disposition: form-data; name="blockId"


------boundary
Content-Disposition: form-data; name="xmlField"


------boundary
Content-Disposition: form-data; name="f"

pjson
------boundary
Content-Disposition: form-data; name="token"

Mya-BuB9qRjkorfcgskCrFjDgcLCqZzehI_3sHMgSVY8JQCdmUHzQCX6qayumb7ecIgrADEuTy-NnF35rlAH9AiXZg3M_AWVNaqyZwM8SNf_mfRVbyf1SfPkUNXJoFVwFYLb1AlIKHm_EONlTvr2V-gaxfnHgpJvvQ5u-mdO9yYvRzjzmuYQge6rsqftqCnXXU9S7NOLmTahmPpRKTGy8c0z2dVlnfZfp7IdnJfmUm-s1I-mu7HDJWTkw4TXxPiL
------WebKitFormBoundaryCuVJC964pmBXvkM6
Content-Disposition: form-data; name="x-ms-blob-type"

BlockBlob
------boundary--

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.