El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

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
Managed Threat Detection
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

Deleting Objects

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

Functions

This operation can be used to batch delete some objects in a bucket. The deletion cannot be undone. After the operation is implemented, the returned information contains the implementation result of each object in the specified bucket. OBS deletes the objects synchronously. The deletion result of each object is returned to the request user.

Objects in batches can be deleted in verbose or quiet mode. With verbose mode, OBS returns results of successful and failed deletion in an XML response; with quiet mode, OBS only returns results of failed deletion in an XML response. OBS uses the verbose mode by default and you can specify the quiet mode in the request body.

For batch deletion, the request header must contain Content-MD5 and Content-Length, so that the message body can be identified if network transmission error is detected at the server side.

Request Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
POST /?delete HTTP/1.1  
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization
Content-MD5: MD5
Content-Length: length

<?xml version="1.0" encoding="UTF-8"?>   
<Delete> 
    <Quiet>true</Quiet>  
    <Object> 
        <Key>Key</Key> 
        <VersionId>VersionId</VersionId> 
    </Object>  
    <Object>  
        <Key>Key</Key> 
    </Object> 
</Delete>

Request Parameters

This request involves no parameters.

Request Headers

This request uses common headers. For details, see Table 3.

Request Elements

This request uses elements to specify the list of objects to be deleted in a batch. Table 1 describes the elements.

Table 1 Request elements

Element

Description

Mandatory

Quiet

Specifies the quiet mode. With the quiet mode, OBS only returns the list of objects that failed to be deleted. This element is valid when set to true. Otherwise, OBS ignores it.

Type: boolean

No

Delete

List of objects to be deleted

Type: XML

Yes

Object

Names of objects to be deleted

Type: XML

Yes

Key

Key of the object to be deleted.

Type: string

Yes

VersionId

Version ID of the object to be deleted

Type: string

No

A maximum of 1,000 objects can be deleted at a time. If you send a request for deleting more than 1,000 objects, OBS returns an error message.

After concurrent tasks are assigned, OBS may encounter an internal error during cyclic deletion of multiple objects. In that case, the metadata still exists when the object index data is deleted, which means data inconsistency.

Response Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
HTTP/1.1 status_code
Date: date
Content-Type: application/xml 
Content-Length: length

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<DeleteResult xmlns="http://obs.region.example.com/doc/2015-06-30/">
<Deleted> 
    <Key>Key</Key> 
</Deleted> 
<Error> 
    <Key>Key</Key> 
    <Code>ErrorCode</Code> 
    <Message>Message</Message> 
</Error> 
</DeleteResult>

Response Headers

The response to the request uses common headers. For details, see Table 1.

Response Elements

This response uses elements to return results of deleted objects in a batch. Table 2 describes the elements.

Table 2 Response elements

Element

Description

DeleteResult

Root node of batch deletion responses

Type: container

Deleted

Container for results of successful deletion

Type: container

Error

Container for results of failed deletion

Type: container

Key

Object names in a deletion result

Type: string

Code

Error code of a deletion failure

Type: string

Message

Error message of a deletion failure

Type: string

VersionId

Version IDs of objects to be deleted

Type: string

DeleteMarker

If this element is specified, true will be returned when you create or delete a delete marker in a bucket with versioning enabled.

Type: boolean

DeleteMarkerVersionId

Indicates the version ID of the delete marker deleted or created by the request.

If you create or delete a delete marker in a bucket with versioning enabled, OBS returns this element in the response. This element will be returned in either of the following cases:

  • You send a request that has only the object name but not the version ID specified. In this case, OBS creates a delete marker and returns its version ID in the response.
  • You send a request that has both the object key and version ID (that identifies a delete marker) specified. In this case, OBS deletes the delete marker and returns its version ID in the response.

Type: boolean

Error Responses

1. If the resolution result of an XML request contains more than 1000 objects, OBS returns 400 Bad Request.

2. If the object key in an XML request is invalid (for example, containing more than 1,024 bytes), OBS returns 400 Bad Request.

3. If the request header does not contain Content-MD5, OBS returns 400 Bad Request.

Other errors are included in Table 2.

Sample Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
POST /test333?delete HTTP/1.1
User-Agent: curl/7.29.0
Host: 127.0.0.1
Accept: */*
Date: WED, 01 Jul 2015 04:34:21 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:8sjZWJlWmYmYnK5JqXaFFQ+vHEg=
Content-MD5: ZPzz8L+hdRJ6qCqYbU/pCw==
Content-Length: 188

<?xml version="1.0" encoding="utf-8"?>
<Delete> 
  <Quiet>true</Quiet>  
  <Object> 
    <Key>obja02</Key> 
  </Object>  
  <Object> 
    <Key>obja02</Key> 
  </Object> 
</Delete>

Sample Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 8DF400000163D3FE4CE80340D30B0542
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCRhY0FBWRm6qjOE1ACBZwS+0KYlPBq0f
Content-Type: application/xml
Date: WED, 01 Jul 2015 04:34:21 GMT
Content-Length: 120

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DeleteResult xmlns="http://obs.example.com/doc/2015-06-30/"/>

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback