Book Image

OpenStack Object Storage Essentials (Update)

Book Image

OpenStack Object Storage Essentials (Update)

Overview of this book

Table of Contents (18 chapters)
OpenStack Object Storage (Swift) Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Swift CLI Commands
Index

Updating the metadata for a container


This section describes how to add or update metadata for a container. Examples showing how to update X-Container-Meta-Countries are covered in the following sections.

Using the Swift client CLI

In this example, we are adding metadata for the countries that we have visited. Execute the following request:

-H "X-Container-Meta-Countries: visited"
swift --os-auth-token=token --os-storage-url= 
http://storage.vedams.com/v1/AUTH_8e43ee201cbc4b70bd8bb2f8ae10f025 post countries 
-H "X-Container-Meta-Countries: visited"

Using the REST API

Here we are adding metadata using the REST API.

Execute this request:

Method : POST

URL    : http://storage.vedams.com/v1/AUTH_8e43ee201cbc4b70bd8bb2f8ae10f025/countries

Header :  X-Auth-Token: token
              X-Container-Meta-Countries: visited
Data   : No content