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

Creating Multiple Historical Versions

Function

Create multiple historical versions.

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.

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

Storage policy of historical versions.

  • 0: automatic clearance

  • 1: permanent storage

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

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 4 Response body parameters

Parameter

Type

Description

id

String

Asset ID

versionId

String

*Asset version ID.

version

String

Version No.

keepPolicy

String

Storage policy of historical versions.

  • 0: automatic clearance

  • 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

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

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 a file is complete.

{
  "fileId" : "FnkL1QhXj8muHBuSWCHtFFY8Azue44Snr",
  "containerId" : "IAADfsBFCO6WtAtuA9add2fea594e4e75b8feb8474ef236",
  "fileName" : "test_20240104_105403.zip",
  "uploadId" : "0000018CD26464022026422966B8879A",
  "parentFolder" : [ "DEUI7pa0C24ArootIAADfsBFCO6WtAtuA9add2fea594e4e75b8feb8474ef236" ],
  "exist" : false,
  "multiParts" : [ {
    "partNumber" : 1,
    "partSize" : 22106481,
    "partOffset" : 0,
    "uploadUrl" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/ff6b221b4b474c829c1cd5037f1504ca086?partNumber=1&uploadId=0000018CD26464022026422966B8879A&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240104T025403Z&X-Amz-SignedHeaders=content-length%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20240104%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Signature=39b9b620c8de901682675059cfcfa9902a13fb5c6ab38fe1451763feb6a8323c"
  } ],
  "code" : 0,
  "msg" : "Success."
}

Status Codes

Status Code

Description

200

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