هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ KooDrive/ API Reference/ API/ File Management/ Creating File Metadata

Creating File Metadata

Updated on 2025-03-07 GMT+08:00

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.

URI

POST /koodrive/ose/v1/files/create

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.

description

No

String

File description.

mimeType

No

String

Resource type.

fileName

Yes

String

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

fileType

Yes

String

File type, which is customizable.

parentFolder

Yes

Array of strings

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.

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

autoRename

Yes

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

Array of MultiPartInfo objects

Part information list.

containerId

Yes

String

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

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.

hidden

No

Boolean

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

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

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.

code

String

Response code.

msg

String

Response 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

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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback