Help Center/ KooDrive/ API Reference/ API/ Multiple File Versions/ Creating Multiple Historical Versions
Updated on 2025-10-22 GMT+08:00

Creating Multiple Historical Versions

Function

Create multiple historical versions.

Authorization Information

No identity policy-based permission required for calling this API.

URI

POST /koodrive/ose/v1/revision/createRevision

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

Yes

String

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. For details about how to obtain an access token, see the corresponding developer guide. The format is Bearer+{access_token}.

X-User-Id

Yes

String

User ID, which is used for app authentication.

X-Date

Yes

String

Date, which is used for app authentication.

Host

Yes

String

Address, which is used for app authentication.

X-Traceid

No

String

Message log trace ID. The value contains 58 bits.

language

No

String

Language code, which complies with the internationalization specifications. For example, en-US indicates English (United States). English (United States) is used by default.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

createdTime

No

String

Time when the file is created. The format is yyyy-MM-dd'T'HH:mm:ss'Z', for example, 2023-08-18T05:43:49Z.

fileId

Yes

String

File ID.

keepPolicy

No

Integer

Retention policy. 0: automatically cleared; 1: permanently stored.

mimeType

No

String

Resource type.

sha256

No

String

Complete file digest calculated using SHA256.

length

Yes

Long

File size, in bytes.

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

uploadMode

Yes

String

Upload mode.

  • multipart: multipart upload.

uploadType

Yes

Integer

Upload type.

  • 0: common upload (not supported yet).

  • 1: multipart upload.

  • 2: versioning upload (not supported yet).

multiParts

No

Array of MultiPartInfo objects

Part information list.

preHash

No

String

Digest of the first 1 KB of the file calculated using SHA256.

proofCode

No

String

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

containerId

Yes

String

Space ID.

Table 3 MultiPartInfo

Parameter

Mandatory

Type

Description

partNumber

Yes

Integer

Part No.

partSize

Yes

Long

Part length. The value range is [5,242,880, 5,368,709,120]. The value range of the last part is [0, 5,368,709,120].

Minimum value: 0.

Maximum value: 5,368,709,120.

partOffset

No

Long

Total length (in bytes) to the last data block. 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.

hashCtx

No

Array of longs

Context used to iteratively calculate SHA256. This field is valid only during concurrent multipart upload. For SHA1, the value is the first to fifth 32-bit variables of the SHA1 of the previous data block. 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.

uploadUrl

No

String

URL for uploading a file, which is a return parameter. The PUT method is required for uploading a file.

partId

No

String

Part object ID.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Asset ID

versionId

String

Asset version ID.

version

String

Version number.

keepPolicy

String

Storage policy of historical versions.

0: automatic clearance. Two versions are retained. The earliest version is deleted when the third version is added. (This prevents obtaining failures in concurrent scenarios.)

1: permanent storage.

rapidUpload

Boolean

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

uploadId

String

File upload ID.

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.

code

String

Return code.

msg

String

Returned information.

Table 5 MultiPartInfo

Parameter

Type

Description

partNumber

Integer

Part No.

partSize

Long

Part length. The value range is [5,242,880, 5,368,709,120]. The value range of the last part is [0, 5,368,709,120].

Minimum value: 0.

Maximum value: 5,368,709,120.

partOffset

Long

Total length (in bytes) to the last data block. 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.

hashCtx

Array of longs

Context used to iteratively calculate SHA256. This field is valid only during concurrent multipart upload. For SHA1, the value is the first to fifth 32-bit variables of the SHA1 of the previous data block. 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.

uploadUrl

String

URL for uploading a file, which is a return parameter. The PUT method is required for uploading a file.

partId

String

Part object ID.

Example Requests

Create file metadata in multipart upload mode. In this example, a part is specified. The upload link of the part is returned in the subsequent response. The part needs to be uploaded through a PUT request.

POST koodrive/ose/v1/revision/createRevision

Authorization:Bearer+10f88*********4791e9ff

{
  "containerId": "IAAAKIRZGifzJgncA1605122035640590977",
  "fileId": "FkiferVNK5NwXck7XXBhPLIRhV1GayJPc",
  "mimeType": "application/vnd.rar",
  "keepPolicy": null,
  "sha256": "d4bb3c0502f28a8e9b1485b55aa410c92a0e4ba07c15548253f3f8f698c7f014",
  "length": 211031,
  "uploadType": 1,
  "autoRename": 2,
  "uploadMode": "multipart",
  "proofCode": "1ca9e8220831d294df0b5aec1d448a4553b125ad0ec307fd",
  "multiParts": [
    {
      "hashCtx": [],
      "partNumber": 1,
      "partOffset": 0,
      "partSize": 211031
    }
  ]

}

Example Responses

Status code: 200

Information returned after the first step of uploading multiple file versions is complete.

{
  "id" : "FiqlY2tOD92pecLKqmktDV5yWZh_bg9XW",
  "versionId" : "1760377209408816384",
  "keepPolicy" : "0",
  "multiParts" : [ {
    "partNumber" : 1,
    "partSize" : 2139005,
    "partOffset" : 0,
    "hashCtx" : [ ],
    "uploadUrl" : "https://obs-koodrive-test-2.obs.cn-north-4.myhuaweicloud.com/552724cc05ef42bbacdc0f52cd0f3d93086?partNumber=1&uploadId=00000198E139C5B1B0447F9253A9BCC4&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250825T123516Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=HPUA1TI53C2TRM9BJTSA%2F20250825%2Fnorth-4%2Fs3%2Faws4_request&X-Amz-Signature=91b2570f27a90fd7245f6b101ccd56575f4ab6ce3f765e7c88328775ab821d54"
  } ],
  "code" : 0,
  "msg" : "success"
}

Status Codes

Status Code

Description

200

Information returned after the first step of uploading multiple file versions is complete.