• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Buckets
  5. PUT Bucket Notification
  6. Requests

Requests

Syntax

PUT /?notification HTTP/1.1
User-Agent: agent 
Host: bucketname.obs.example.com
Accept: */* 
Date: date 
Authorization: authorization
Content-Length: length
Expect: expect
 
<NotificationConfiguration> 
 <TopicConfiguration> 
  <Id>ConfigurationId</Id>
  <Filter>
   <S3Key>
    <FilterRule>
     <Name>prefix</Name>
     <Value>prefix-value</Value>
    </FilterRule>
    <FilterRule>
     <Name>suffix</Name>
     <Value>suffix-value</Value>
    </FilterRule>
   </S3Key>
  </Filter>
  <Topic>TopicARN</Topic>
  <Event>event-type</Event>
  <Event>event-type</Event>
  ...
 </TopicConfiguration>
</NotificationConfiguration>

Request Parameters

This request contains no parameter.

Request Headers

This request uses common headers. For details, see section Common Request Headers.

Request Elements

This request contains elements to specify the notification configuration for the bucket in XML format. The following table lists the request elements.

Table 1 Request elements of notification function configuration

Element

Description

Mandatory or Not

NotificationConfiguration

Container for configuring the event notification function of a bucket. If this element is null, the function is disabled.

Type: Container

Ancestor: None

Children: zero TopicConfiguration, one TopicConfiguration, or TopicConfigurations

Yes

TopicConfiguration

Container for configuring the event notification topic

Type: Container

Ancestor: NotificationConfiguration

Children: Id, Filter, Topic, Event or Events

No

Topic

URN of the event notification topic. After detecting a specific event, OBS sends a message to the topic.

Type: String

Ancestor: TopicConfiguration

Yes if ancestor TopicConfiguration is added

Id

Unique ID of each event notification. If the user does not specify an ID, the system assigns an ID automatically.

Type: String

Ancestor: TopicConfiguration

No

Filter

Container of S3Key used to store rules of filtering object names

Type: Container

Ancestor: TopicConfiguration

Children: S3Key

No

S3Key

Container that defines filtering rules. The rules filter objects based on the prefixes and suffixes of object names.

Type: Container

Ancestor: Filter

Children: One FilterRule or FilterRules

No

FilterRule

Container that defines key-value pairs of filtering rules

Type: Container

Ancestor: S3Key

Children: Name, Value

No

Name

Specifies the prefix or suffix of object names for filtering.

Type: String

Ancestor: FilterRule

Legal value: prefix or suffix

No

Value

Specifies keywords of object names so that objects can be filtered based on the prefixes or suffixes. The value contains a maximum of 1024 characters.

Type: String

Ancestor: FilterRule

No

Event

Type of events that need to be notified

NOTE:

Multiple event types can be added in one TopicConfiguration configuration item.

Type: String

Ancestor: TopicConfiguration

Yes if ancestor TopicConfiguration is added