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

Creating File Metadata

Function

Create the metadata of the uploaded file. If flash upload is not hit, the upload process is triggered. If flash upload is hit, the file upload is complete. Data files need to be loaded to the Singapore node for processing.

URI

POST /koodrive/ose/v1/files/create

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

language

No

String

Definition:

Language code.

Constraints:

The value must comply with the internationalization specifications. For example, en_us indicates English (United States).

Range:

N/A

Default Value:

If this parameter is not transferred, English (United States) is used by default.

Authorization

Yes

String

Definition:

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-Traceid

No

String

Definition:

Message log trace ID. The value contains 58 bits.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

X-User-Id

Yes

String

Definition:

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

Constraints:

N/A

Range:

N/A

Default Value:

N/A

X-Date

Yes

String

Definition:

Date, which is used for app 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

x-hw-share-folder-id

No

String

Definition:

ID of the shared folder. If this request header is passed, the current operation is performed in the shared folder.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

createdTime

No

String

Definition:

File creation time.

Constraints:

The format is yyyy-MM-dd HH:mm:ss.

Range:

N/A

Default Value:

N/A

description

No

String

Definition:

File description.

Constraints:

The length cannot exceed 512.

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.

Constraints:

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

Range:

N/A

Default Value:

N/A

fileType

Yes

String

Definition:

File type, which is customizable.

Constraints:

N/A

Range:

15: image 20: video 26: Word file 27: Excel file 28: PowerPoint file 30: audio 35: compressed file 40: application 45: others

Default Value:

N/A

parentFolder

Yes

Array of strings

Definition:

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

Constraints:

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

Range:

N/A

Default Value:

N/A

sha256

No

String

Definition:

Complete file digest calculated using SHA256.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

length

Yes

Long

Definition:

File length.

Constraints:

The unit is byte. When uploadMode is set to multipart, the value must be less than or equal to 200 GB.

Range:

N/A

Default Value:

N/A

uploadMode

Yes

String

Definition:

Upload mode.

Constraints:

N/A

Range:

multipart: multipart upload

Default Value:

N/A

uploadType

Yes

Integer

Definition:

Upload type.

Constraints:

N/A

Range:

0: common upload (not supported currently) 1: multipart upload 2: multi-version upload (not supported currently)

Default Value:

N/A

autoRename

Yes

Integer

Definition:

Policy for specifying how to handle duplicate names.

Constraints:

N/A

Range:

Enumerated values: 2: Forcibly rename a file with an existing name by adding a timestamp to the end of the file name. 3: Reject files with the same name. A file with an existing name cannot be created. 4: Do not create a file if files with the same name have the same SHA256 value, or, uses the forcible renaming logic.

Default Value:

N/A

multiParts

No

Array of MultiPartInfo objects

Definition:

Part information list.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

containerId

Yes

String

Definition:

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

Constraints:

N/A

Range:

N/A

Default Value:

N/A

preHash

No

String

Definition:

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

Constraints:

N/A

Range:

N/A

Default Value:

N/A

proofCode

No

String

Definition:

Storage signature.

Constraints:

Generated using the binary data of the file and used to prevent credential stuffing.

Range:

N/A

Default Value:

N/A

hidden

No

Boolean

Definition:

Whether the file is hidden.

Constraints:

Currently, this function is available only to whitelisted users.

Range:

N/A

Default Value:

N/A

scene

No

String

Definition:

Custom property.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

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

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 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

Creates 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/files/create

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

{
    "containerId": "IAADfsBFCO6WtAtuA9add2fea594e4e75b8feb8474ef236",
    "parentFolder": [
        "root"
    ],
    "createdTime": "2020-05-18T01:43:49Z",
    "mimeType": "application/x-zip-compressed",
    "fileType": 35,
    "fileName": "demo.zip",
    "sha256": "08a784aeb181506391c20c6355f881dc363d8c3e0739d295e5d6f410d05dbc69",
    "length": 22106481,
    "uploadMode": "multipart",
    "uploadType": 1,
    "autoRename": 2,
    "multiParts": [
        {
            "partNumber": 1,
            "partOffset": 0,
            "partSize": 22106481
        }
    ],
    "description": ""
}

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.