Loading...

Initiate an Upload Session to Edge Drive (REST API: POST)

Use this operation to initiate the upload session for uploading multiple file chunks to Edge Drive. Optionally, you can also send the first file chunk along with the request.

When you initiate an upload session, you can also enable block level file integrity check for the complete file, using Secure Hash Algorithm (SHA) - 256 cryptographic hash function. For more information, see File Integrity Check.

Request

Syntax

POST <webservice>/drive/file/action/upload?uploadType=chunkedFile&verifyBlockLevelFileIntegrity=true HTTP/1.1
Host: <host name>
Accept: application/xml
Authtoken: <authentication token>
ExternalFileGUID: <GUID from an external source>
FileName: <file name in base64 format>
FileSize: <file size in bytes>
FileModifiedtime: <modified time in UNIX timestamp>
ParentFolderPath: <file path in base64 format>

where <webservice> is the root path used to route the API requests to the Web Server.

For more information, see Available Web Services for REST API.

Request Parameter

Name

Description

Required

verifyBlockLevelFileIntegrity

Specify the value, true,to enable file integrity check using the combined hash value of all the chunks.

No

Request Headers

Name

Description

Host

The host name of the Web Server or Web Console used in the API request.

Accept

The format of the response. Valid values are: application/xml or application/json.

Authtoken

The authentication token received after successfully logging on. For details on receiving an authentication token, see Authentication.

ExternalFileGUID

(optional) If you have a 128-bit globally unique identifier (GUID) outside of the Commvault software, you can add it as a header so that it is assigned as the fileGUID for the file you are uploading.

If you send a GUID that includes hyphens, the hyphens are removed. Any request or search that uses your GUID must not include the hyphens.

FileName

Name of the file to be uploaded. The name must be base64 encoded.

FileSize

Size (in bytes) of the file to be uploaded.

FileModifiedtime

The last modified time of the file to be uploaded. Provide the value in UNIX timestamp format (in seconds). For example, 1424813723.

ParentFolderPath

The path to the destination folder where the file will be uploaded. The path must be relative from the root path and base64 encoded.

FileEOF

Specifies whether the end of file has reached with the current file chunk. Allowed values are 0 and 1.

To indicate end of file, enter the value 1.

If end of file has not reached, you can skip this header or enter the value 0.

Request Body

If you are sending the first file chunk along with the API request, then include the contents of the file chunk in bytes. Do not include the content-type header.

Response

Response Parameters

Parameter

Description

Element

chunkOffset

The number of bytes received by the Web Server for the uploaded file chunk.

DM2ContentIndexing_UploadFileResp

requestId

A unique identifier for the current upload session.

Provide this value as input for uploading the file data chunks. For details, see POST File Data Chunk Upload to Edge Drive.

DM2ContentIndexing_UploadFileResp

errorCode

The possible error codes.

Valid values are:

  • 200, successful completion.
  • a specific error code.

response

Examples

Sample Request

POST <webservice>/drive/file/action/upload?uploadType=chunkedFile&verifyBlockLevelFileIntegrity=true HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6
0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f
8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f
40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7
68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323
3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
FileName: VHVsaXAuanBn
FileSize: 845941
FileModifiedtime: 1424813723
ParentFolderPath: XHBpY3R1cmVz

Supported Error Codes

Code

Status

Description

400

Bad Request

The request is missing required headers or file content in the request body.

Make sure the parameter values and format in the header request are correct. For example, the header request for file modified time must be specified in UNIX timestamp format (in seconds). Specifying a millisecond value will return an error. Also, the name must be base64 encoded.

403

Forbidden

The user does not have rights to upload the file or the upload operation is disabled by the administrator by disabling backup activity from the CommCell Console.

409

Conflict

An upload operation is already in progress for the same file. The response body will have the existing requestId and the number of bytes that the web server has already received for the file. For example:

<DM2ContentIndexing_UploadFileResp requestId="13213022088234198160108125214183230586134182" chunkOffset="780830" errorCode="409" />

When a conflict occurs,

  • Use the same requestID to resume a chunk file upload from the byte offset sent from the server by sending data chunks.

    /drive/file/action/upload?uploadType=chunkedFile&requestId="13213022088234198160108125214183230586134182"

  • Use the following URL parameter to force restart the upload of the file from the beginning. If this approach is used a new upload request session will be initiated and response will have the requestID.  Using the new requestID, the file data can be sent from beginning.

    /drive/file/action/upload?uploadType=chunkedFile&forceRestart=true

Last modified: 12/18/2018 5:16:19 PM