post

Prev Next

Available in Classic and VPC

Change the metadata for an account, container (bucket), or object. If the container does not exist, it will be created automatically.

Syntax

The post syntax is as follows:

  • Account

    swift post \
        [--meta <name:value>] \
        [--header <header:value>]
    
  • Container

    swift post \
        <container> \
        [--read-acl <acl>] \
        [--write-acl <acl>] \
        [--meta <name:value>] \
        [--header <header:value>]
    
  • Object

    swift post \
        <container> <object> \
        [--meta <name:value>] \
        [--header <header:value>]
    

Options

This section describes the options available when running post.

Required options

The following options are required for post.

Options Type Required Description
<container> String Conditional Container name
  • If left blank, the account's metadata is changed.
  • If a nonexistent container is entered, it is automatically created.
  • Required when entering <object>.

Optional options

These are the optional options for post. Options that are not specified will use their default values.

Options Type Required Description
<object> String Optional Object name
  • Enter along with <container>.
--read-acl String Optional Container's read ACL
  • Example: .r:*, .r:-.example.com, .r:www.example.com, account1:*, account2:user2.
  • account1 format is only available in the v1.0 authentication API.
  • For the full ACL syntax, see the OpenStack Swift CLI documentation.
--write-acl String Optional Container's write ACL
  • Example: account1:*, account2:user2
  • account1 format is only available in the v1.0 authentication API.
  • For the full ACL syntax, see the OpenStack Swift CLI documentation.
--meta String Optional Metadata entry
  • Enter in the name:value format.
  • Multiple metadata entries can be set (e.g., --meta name1:value1 --meta name2:value2).
--header String Optional Custom header to use in the request
  • Enter in header:value format.

Common options

For information about the options common to all swift subcommands, see Archive Storage options.

Examples

The following is an example of using the post command to create a container or set metadata.

Command

The following is an example command for creating a container.

swift post test-container-01

The following is an example command for setting metadata for a container.

swift post test-container-01 --meta Purpose:Documentation

Output

If the request is successful, no output is displayed. You can verify the updated metadata at stat.