Objects: compose

Concatenates a list of existing objects into a new object in the same bucket. Try it now.

There is a limit (currently 32) to the number of components that can be composed in a single operation.

The authenticated user must have READER permissions on every source object and WRITER  permissions on the destination bucket.

To compose objects encrypted by a customer-supplied encryption key, use the headers listed on the Encryption page in your request.

Request

HTTP request

POST https://www.googleapis.com/storage/v1/b/destinationBucket/o/destinationObject/compose

Parameters

Parameter name Value Description
Path parameters
destinationBucket string Name of the bucket in which to store the new object.
destinationObject string Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.
Optional query parameters
destinationPredefinedAcl string Apply a predefined set of access controls to the destination object.

Acceptable values are:
  • "authenticatedRead": Object owner gets OWNER access, and allAuthenticatedUsers get READER access.
  • "bucketOwnerFullControl": Object owner gets OWNER access, and project team owners get OWNER access.
  • "bucketOwnerRead": Object owner gets OWNER access, and project team owners get READER access.
  • "private": Object owner gets OWNER access.
  • "projectPrivate": Object owner gets OWNER access, and project team members get access according to their roles.
  • "publicRead": Object owner gets OWNER access, and allUsers get READER access.
ifGenerationMatch long Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.
ifMetagenerationMatch long Makes the operation conditional on whether the object's current metageneration matches the given value.

Request body

In the request body, supply data with the following structure:

{
  "kind": "storage#composeRequest",
  "contentType": string,
  "sourceObjects": [
    {
      "name": string,
      "generation": long,
      "objectPreconditions": {
        "ifGenerationMatch": long
      }
    }
  ],
  "destination": objects Resource
}
Property name Value Description Notes
kind string The kind of item this is.
destination nested object Properties of the resulting object. writable
sourceObjects[] list The list of source objects that will be concatenated into a single object.
sourceObjects[].name string The source object's name. The source object's bucket is implicitly the destination bucket. writable
sourceObjects[].generation long The generation of this object to use as the source. writable
sourceObjects[].objectPreconditions object Conditions that must be met for this operation to execute.
sourceObjects[].objectPreconditions.ifGenerationMatch long Only perform the composition if the generation of the source object that would be used matches this value. If this value and a generation are both specified, they must be the same value or the call will fail. writable

Response

By default, this responds with an object resource in the response body. If you provide the URL parameter alt=media, then it will respond with the object data in the response body.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Storage Documentation