Copy an Object

An object can be copied to another object within the same or another container. There is no need to download the object and then upload it again; the copying operation is performed entirely on the server.

  1. To send REST API calls to Object Storage Classic, you need a valid authentication token. If you obtained a token less than 30 minutes ago, then you can use that token. Otherwise, get a new token as described in Get an Authentication Token.
  2. Send a COPY call to the object you want to copy, and specify the destination container and object in the Destination header.

    Syntax

    curl -X COPY \
      {accountRestEndpointURL}/{sourceContainerName}/{sourceObjectName} \
      -H 'Destination: {destinationContainerName}/{destinationObjectName}' \
      -H 'x-auth-token: {authToken}'

    Sample Command

    curl -X COPY \
      https://myaccount.ocm.rack01.example.com/v1/Storage-myaccount/mycontainer/myobject \
      -H 'Destination: myothercontainer/myobjectopy'
      -H 'x-auth-token: AUTH_tk10d7cf10041726fa2e64652d975bbab0'
  3. The output is a list of the containers in the account.