This operation uploads a single file to Edge Drive. The API is used for uploading files that are relatively small in size. You can also verify the file integrity using Secure Hash Algorithm (SHA) - 256 cryptographic hash function. For more information, see File Integrity Check.
For larger files (greater than 4 MB), upload the files in multiple data chunks. For more information, see Initiate an Upload Session.
Request
Syntax
POST webservice/drive/file/action/upload?uploadType=fullFile 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
FullFileHash: SHA hash of the file
file contentswhere <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 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. |
|
FullFileHash |
(optional) The SHA hash of the complete file. Use SHA 256 to compute the hash value. |
Request Body
Include the entire file contents. 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. |
DM2ContentIndexing_UploadFileResp |
|
fileGUID |
The GUID of the uploaded file. |
DM2ContentIndexing_UploadFileResp |
|
fileIntegrityVerified (optional) |
Value 1 indicates that the hash value is identical and the file integrity check is verified. |
DM2ContentIndexing_UploadFileResp |
|
errorCode |
The possible error codes. Valid values are:
|
response |
Examples
Sample Request
POST webservice/drive/file/action/upload?uploadType=fullFile HTTP/1.1
Host: client.mydomain.com
Accept: application/xml
Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc60f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef768fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f3233d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8
FileName: Zmxvd2Vycy50eHQ=
FileSize: 845941
FileModifiedtime: 1424813723
ParentFolderPath: XHBsYW50cw0K
FullFileHash: f666c37a95e2f0ce1a9318130a16f3709879832136310b6a7ca07b75ae594e3c
file contentsSupported Error Codes
|
Code |
Status |
Description |
|---|---|---|
|
400 |
Bad Request |
The request is missing required headers or file content in the request body. |
|
403 |
Forbidden |
Error due to one of the following reasons:
|
|
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. Example:
When a conflict occurs do the following:
|
|
413 |
Request Entity Too Large |
Upload attempted for a large file (greater than 4MB). For large files, upload the files in multiple data chunks. For more information, see Initiate an Upload Session. |