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
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
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
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
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
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 (CCI)
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
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
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
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Uploading a File

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

Function

Upload local files to the storage. By default, files are uploaded to the first bucket set up for the connector. These files can be texts, images, or videos.

URI

POSTHuawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/putobject?object=X

Table 1 URI parameters

Parameter

Mandatory

Type

Description

connector_type

Yes

String

Explanation

Type of a connector.

Constraints

None

Value

  • obs: connector for interconnecting with OBS.
  • minio: connector for connecting to MINIO.
  • objectstorageproxy: object storage proxy type.

Default value

None

connector_name

Yes

String

Explanation

Name of the connector instance, that is, the connector instance name set when the connector is created.

Constraints

None

Value

None

Default value

None

object

No

String

Explanation

Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

For example, if the value is a/b/c/1.txt, file 1.txt is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

Constraints

None

Value

None

Default value

None

Request Parameters

Body type in the request, in the multipart/form-data format.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

dir

No

String

Explanation

Directory of the file to be uploaded in the bucket.

Constraints

None

Value

None

Default value

If this parameter is left blank, the root directory of the bucket is used.

acl

No

String

Explanation

Access control permission on uploaded files.

Constraints

None

Value

  • private
  • public-read
  • public-read-write
  • default: The permission is the same as that configured for the bucket.

Default value

If this parameter is not configured, the permission configured for the bucket is used.

object

Yes

String

Explanation

File data to be uploaded, including the file name and content.

Constraints

None

Value

None

Default value

None

Response Parameters

Table 3 Response parameters

Parameter

Type

Description

resCode

String

Explanation

Return code.

Value

If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

resMsg

String

Explanation

Message returned.

Value

If the request is successful, Success is returned. In other cases, an error message is returned.

result

Object

Explanation

If the request is successful, the path of the uploaded file in the bucket is returned.

Example Request

Create an OBS connector. Assume that the connector instance name is namespace__TestOBS. Upload the 1.txt file to the a/b/c directory of the OBS bucket. When you call an API to upload a file, the file can be uploaded only to the first bucket configured for the connector.

POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/putobject?object=a/b/c/1.txt

In the request parameters, set the object in the multipart/form-data format, that is, the file data to be uploaded.

Figure 1 Setting the request parameter

After the preceding operations are complete, the 1.txt file is successfully uploaded to the a/b/c directory in the OBS bucket.

Example Response

{
	"resCode": "0",
	"resMsg": "Success",
	"result": {
		"object": "a/b/c/1.txt"
	}
}

Status Code

See Status Codes.

Error Code

See Error Codes.

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