Updated on 2026-02-12 GMT+08:00

Creating a Backup File

Function

Create a backup file.

URI

POST /koodrive/ose/v1/backup/record/{recordId}/file

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

recordId

Yes

String

Definition:

Backup record ID.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

x-backup-lock-id

Yes

String

Definition:

Lock ID.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Authorization

Yes

String

Definition:

This field stores the access token.

Token authentication is used to call KooDrive APIs. A token indicates the permission. When an API is called, the token is added to the request header to obtain the operation permission.

Constraints:

The format is bearer+access token.

Range:

For details about how to obtain an access token, see the corresponding developer guide.

Default Value:

N/A

X-User-Id

Yes

String

Definition:

User ID on KooDrive, which is used for app ID authentication.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

X-Date

Yes

String

Definition:

Signature time, which is used for app ID authentication.

Constraints:

The value must be within 15 minutes from the current time and cannot be later than the current time.

Range:

The format is yyyMMdd'T'HHmmss'Z', for example, 20251103T070140Z.

Default Value:

N/A

Definition:

Signature time, which is used for app ID authentication.

Constraints:

The value must be within 15 minutes from the current time and cannot be later than the current time.

Range:

The format is yyyMMdd'T'HHmmss'Z', for example, 20251103T070140Z.

Default Value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

description

No

String

Definition:

File description.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

mimeType

No

String

Definition:

Resource type.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

fileName

Yes

String

Definition:

File name, which cannot contain the following characters: '<>|:"*? /', cannot be '..', '.', '', and can contain up to 250 characters.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

fileType

No

String

Definition:

File type, which is customizable.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

parentFolder

No

Array of strings

Definition:

Parent directory ID list. If the target directory is a root directory, the value is root.

Currently, only one parent directory is supported. If multiple parent directory IDs are passed, only the first one is used.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

sha256

Yes

String

Definition:

Complete file digest calculated using SHA256.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

length

Yes

Long

Definition:

File size, in bytes.

If uploadMode is set to multipart, the value must be less than or equal to 200 GB.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

uploadMode

No

String

Definition:

Upload mode.

  • multipart: multipart upload.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

uploadType

No

Integer

Definition:

Upload type.

Constraints:

N/A

Range:

Enumeration values:

  • 0: common upload (not supported yet).

  • 1: multipart upload.

  • 2: versioning upload (not supported yet).

Default Value:

N/A

autoRename

No

Integer

Duplicate name policy.

  • 2: Forcibly renames a file with an existing name by adding a timestamp to the end of the file name.

  • 3: Rejects files with the same name. A file with an existing name cannot be created.

  • 4: Does not create a file if files with the same name have the same SHA256 value, or, uses the forcible renaming logic.

multiParts

No

MultiPartInfo object

Definition:

Part information list.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

containerId

No

String

Definition:

ID of the target space to which the file is uploaded.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

proofCode

No

String

Definition:

Storage signature, generated using the binary data of the file and used to prevent credential stuffing. This parameter is mandatory when sha256 is transferred.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

hidden

No

Boolean

Definition:

Whether the file is hidden. (This function is available only to whitelisted users.)

Constraints:

N/A

Range:

N/A

Default Value:

N/A

scene

No

String

Definition:

Custom property, which is used in the backup scenario.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Table 4 MultiPartInfo

Parameter

Mandatory

Type

Description

partNumber

Yes

Integer

Definition:

Part No.

Constraints:

The part number ranges from 1 to 10000.

Range:

N/A

Default Value:

N/A

partSize

Yes

Long

Definition:

Part length.

Constraints:

N/A

Range:

minimum: 0 -maximum: 5368709120. The value range is [5,242,880, 5,368,709,120]. The value range of the last part is [0, 5,368,709,120].

Default Value:

N/A

partOffset

No

Long

Definition:

Total length to the last data block.

Constraints:

The unit is byte. This parameter is valid only during concurrent multipart upload. The size of all parts except the last one must be a multiple of 64 bytes.

Range:

N/A

Default Value:

N/A

hashCtx

No

Array of longs

Definition:

Context used to iteratively calculate SHA256.

Constraints:

This field is valid only during concurrent multipart upload. For SHA256, the value is the first to eighth 32-bit variables of the SHA256 of the previous data block.

This parameter is mandatory for all parts except the first one in concurrent multipart upload.

Range:

N/A

Default Value:

N/A

uploadUrl

No

String

Definition:

URL for uploading a file.

Constraints:

The PUT method is required for uploading files.

Range:

N/A

Default Value:

N/A

partId

No

String

Definition:

Part object ID.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

fileId

String

File ID.

rapidUpload

Boolean

Whether flash upload is hit. true indicates that flash upload is hit.

containerId

String

ID of the space where the file is located.

fileName

String

Name of the uploaded file. If the file is not renamed, the value is the same as the file name in the request parameter.

uploadId

String

File upload ID.

parentFolder

Array of strings

ID of the parent directory where the uploaded file is located.

exist

Boolean

Whether the file exists. This parameter is used only when the input parameter autoRename is set to 4. If the file names and SHA256 values are the same, true is returned.

multiParts

Array of MultiPartInfo objects

Part information, which is returned during multipart upload (when uploadMode is set to multipart).

matchedPreHash

Boolean

Whether a matching prehash exists.

existFileId

String

If the renaming policy is set to deny renaming and there is a file with the same name, the ID of the existing file is returned.

code

String

Response code.

msg

String

Response information.

Table 6 MultiPartInfo

Parameter

Type

Description

partNumber

Integer

Definition:

Part No.

Constraints:

The part number ranges from 1 to 10000.

Range:

N/A

Default Value:

N/A

partSize

Long

Definition:

Part length.

Constraints:

N/A

Range:

minimum: 0 -maximum: 5368709120. The value range is [5,242,880, 5,368,709,120]. The value range of the last part is [0, 5,368,709,120].

Default Value:

N/A

partOffset

Long

Definition:

Total length to the last data block.

Constraints:

The unit is byte. This parameter is valid only during concurrent multipart upload. The size of all parts except the last one must be a multiple of 64 bytes.

Range:

N/A

Default Value:

N/A

hashCtx

Array of longs

Definition:

Context used to iteratively calculate SHA256.

Constraints:

This field is valid only during concurrent multipart upload. For SHA256, the value is the first to eighth 32-bit variables of the SHA256 of the previous data block.

This parameter is mandatory for all parts except the first one in concurrent multipart upload.

Range:

N/A

Default Value:

N/A

uploadUrl

String

Definition:

URL for uploading a file.

Constraints:

The PUT method is required for uploading files.

Range:

N/A

Default Value:

N/A

partId

String

Definition:

Part object ID.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Example Requests

Request example for creating a backup file.

/koodrive/ose/v1/backup/record/1842862763295184641/file

Authorization:Bearer+60f4ccc7b1********3dd9a68068
x-backup-lock-id: 78e41c7e-db02-4d55-85b3-8153e4fefd2e@102
{
    "containerId": "IAAFfyRNd07vFgAAA1395638440594444417",
    "parentFolder": [
        "root"
    ],
    "mimeType": "",
    "fileType": 15,
    "fileName": "123.jpg",
    "sha256": "c0ad38a9864a3261a92a3e9daf0d325c5ca45a7a9039ee681d608a5392350286",
    "length": 108274,
    "uploadType": 1,
    "autoRename": 2,
    "uploadMode": "multipart",
    "multiParts": [
        {
            "hashCtx": [],
            "partNumber": 1,
            "partOffset": 0,
            "partSize": 108274
        }
    ],
    "proofCode": "03dfd964183d72456b7c3093ecaddfb92e851f3bc6611489831ef91aebdda215"
}

Example Responses

Status code: 200

Response body for creating a backup file.

{
  "fileId" : "FmHi5mWOmHsgHs8hrOKpC-IslaiKmJh7I",
  "containerId" : "IAAFfyRNd07vFgAAA1395638440594444417",
  "fileName" : "123_20251218_093235.jpg",
  "uploadId" : "0000019B2F1665EEF008B1D596D3B1A9",
  "parentFolder" : [ "DE13Tu8WAAAArootIAAFfyRNd07vFgAAA1395638440594444417" ],
  "exist" : false,
  "multiParts" : [ {
    "partNumber" : 1,
    "partSize" : 108274,
    "partOffset" : 0,
    "hashCtx" : [ ],
    "uploadUrl" : "https://obs-koodrive-test-2.obs.cn-north-4.myhuaweicloud.com/e24ce0b4cc1e49c49fcdba320ca815fc086?partNumber=1&uploadId=0000019B2F1665EEF008B1D596D3B1A9&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20251218T013236Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=HPUA8WFGVY35JSJDL1GV%2F20251218%2Fnorth-4%2Fs3%2Faws4_request&X-Amz-Signature=ccb5bf60daf3ebe34ba974bc0b6e4a37ce618af008795368f01b4d00d8151e7d"
  } ],
  "code" : 0,
  "msg" : "Success."
}

Status Codes

Status Code

Description

200

Response body for creating a backup file.