Updated on 2024-07-04 GMT+08:00

Creating a Large File

Function

Creates a large file (larger than 5 GB) and obtains the URL for multi-part upload URL.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/large-files

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

You can obtain the token by calling the IAM API used to obtain a user token.

Value of X-Subject-Token in the response header.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

The format is YYYYMMDD'T'HHMMSS'Z'.

X-App-UserId

No

String

Third-party user ID, which does not allow Chinese characters.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

file_name

Yes

String

File name, which is case-insensitive. The value ranges from 1 to 256.

file_size

No

Long

Total file size. The value ranges from 1 to 5368709120.

file_type

Yes

String

File type (the file suffix is extracted by default).

asset_id

Yes

String

Asset ID.

asset_file_category

Yes

String

File category in an asset. Each type of asset has different file categories.

  • MAIN: main file

  • OTHER: other files

file_multipart_count

No

Integer

Number of 4K ORI file parts to be uploaded. The default value is 1.

Response Parameters

Status code: 200

Table 4 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Request ID.

Table 5 Response body parameters

Parameter

Type

Description

file_id

String

File ID.

upload_urls

Array of strings

URL for uploading file parts.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

POST https://{endpoint}/v1/6a6a1f8354f64dd9b9a614def7b59d83/files

{
  "file_name" : "1.png",
  "file_type" : "zip",
  "asset_id" : "8cb2f48a2cb006154794741933421100",
  "asset_file_category" : "OTHER"
}

Example Responses

Status code: 200

Succeeded.

{
  "file_id" : "b2f8a9e9c39b6dc7ed4c0cfd67366c6a",
  "upload_urls" : [ "https://{endpoint}:443/0d697589d98091f12f92c0073501cd79/942e65a5fd219a2e01fb08d881cfadb9/ori4k.zip?AccessKeyId=BHFSP0ZDGFL6BLGHCNPK&Expires=1695532670&partNumber=1&uploadId=0000018AC154BC218415213228194267&Signature=FrLhTRdhMjpAFVb%2Ff%2BcGJQgvjlw%3D", "https://{endpoint}:443/0d697589d98091f12f92c0073501cd79/942e65a5fd219a2e01fb08d881cfadb9/ori4k.zip?AccessKeyId=BHFSP0ZDGFL6BLGHCNPK&Expires=1695532670&partNumber=2&uploadId=0000018AC154BC218415213228194267&Signature=FrLhTRdhMjpAFVb%2Ff%2BcGJQgvjlw%3D" ]
}

Status code: 400

{
  "error_code" : "MSS.00000003",
  "error_msg" : "Invalid parameter"
}

Status code: 401

{
  "error_code" : "MSS.00000001",
  "error_msg" : "Unauthorized"
}

Status code: 500

{
  "error_code" : "MSS.00000004",
  "error_msg" : "Internal Error"
}

Status Codes

Status Code

Description

200

Succeeded.

400

Parameters error, including the error code and its description.

401

Authentication is not performed or fails.

500

Internal service error.

Error Codes

See Error Codes.