• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Swift)
  4. Operations on Objects
  5. Copy Object
  6. Request

Request

Method

Table 1 Method description

Method

URI

Description

COPY

/v1/{account}/{container}/{object}

Copies an object to another object in OBS (compatible with OpenStack Swift).

{account} indicates the name of an account.

{container} indicates the name of a container.

{object} indicates the name of an object.

This operation does not involve a request body.

Example Request

Copy the goodbye object from the marktwain container to the janeausten container:

curl -i $publicURL/marktwain/goodbye -X COPY -H "X-Auth-Token:
$token" -H "Destination: janeausten/goodbye"
curl -i $publicURL/janeausten/goodbye -X PUT -H "X-Auth-Token:
$token" -H "X-Copy-From: /marktwain/goodbye" -H "Content-Length:
0"

Request Query Parameters

This operation does not include request query parameters.

Request Headers

Request URI parameters

Parameter

Type

Description

{account}

String

(Required)

Unique name of the account. In the current version, it indicates the unique ID of the account.

{container}

String

(Required)

Unique name of the container.

For details about container naming rules, see Naming Rules.

{object}

String

(Required)

Name of the object.

For details about object naming rules, see Object Naming Rules.

Table 2 Request header parameters

Header

Type

Description

X-Auth-Token

String

(Required)

Authentication token. If you omit this header, your request fails unless the account owner has granted you access through an ACL.

Destination

String

(Required)

The container and object name of the destination object in the form of /container/object.

X-Object-Meta-name

String

(Optional)

Object metadata, where {name} is the name of the metadata item. You must specify an X-Object-Meta-{name} header for each metadata item (for each {name}) that you want to add or update.

Content-Type

String

(Optional)

Sets the MIME type of the object.

Content-Length

String

(Optional)

Object length.

Content-Disposition

String

(Optional)

When the header is set to {newname} and an object is downloaded through a browser, the default object name {newname} is returned.

Content-Encoding

String

(Optional)

If this header is set, the value is the encoding format used when an object is downloaded through a browser.

X-Copy-From

String

(Optional)

Container and object name of the source object in the form of /container/object.

NOTE:

If the X-Copy-From or Destination header is used to specify the name of a source or destination object, only the /container/object format is supported. OpenStack Swift supports the name of a source or destination object with a URL.