Create container, or bulk-create objects in a container
/v1/{account}/{container}
extract-archive
query parameter specified, creates multiple objects in the named container.Request
-
account: string
The unique name for the account. An account is also known as the project or tenant.
-
container: string
The unique name for the container. The container name must be from 1 to 256 characters long and can start with any character and contain any pattern. Character set must be UTF-8. The container name cannot contain a slash (
/
) character because this character delimits the container and object name. For example,/account/container/object
.
-
extract-archive(optional): string
Optional parameter indicating that this is a bulk create operation. The value of this parameter identifies the request payload archive format.
Valid values include
tar
,tar.gz
, andtar.bz2
.When
extract-archive
is specified, thecontainer
path parameter becomes the object "upload path": all objects present in the payload archive are created in the specified container. All other bulk creation behavior is the same as bulk creation without the upload path.Consult Create multiple containers and multiple objects for more details.
Allowed Values:[ "tar", "tar.gz", "tar.bz2" ]
-
repPolicy(optional): string
Marker parameter to set the Container Replication Policy during the creation of a container.
To set the container-level replication policy for the container
myFirstContainer
:$ curl -v -X PUT -H 'X-Auth-Token: 0101010101' \-d "@payload_file"
Example payload:https://foo.storage.oraclecloud.com/v1/myservice-bar/myFirstContainer?repPolicy
{ " sourceRegion": { "name": "string", "url": "string" }, "targetRegions": [ { "name": "string","url": "string" }], "externalSourceRegions": [{ "name": "string","url": "string"}], "externalTargetRegions": [{ "name": "string","url": "string" }]}
Default Value:plain
-
X-Auth-Token: string
Authentication token.
-
X-Container-Meta-Access-Control-Allow-Origin(optional): string
List of origins to be allowed to make cross-origin Requests. Entries in the list are space-separated.
-
X-Container-Meta-Access-Control-Expose-Headers(optional): string
List of headers exposed to the user agent (e.g. browser) in the actual request response. Entries in the list are space-separated.
-
X-Container-Meta-Access-Control-Max-Age(optional): integer
Minimum Value:
0
Maximum age in seconds for the origin to hold the preflight results. -
X-Container-Meta-Temp-URL-Key(optional): string
The secret key value for temporary URLs.
-
X-Container-Meta-Temp-URL-Key-2(optional): string
A second secret key value for temporary URLs. The second key enables you to rotate keys by having two active keys at the same time.
-
X-Container-Meta-{name}(optional): string
The container metadata, where
{name}
is the name of metadata item. You must specify anX-Container-Meta-{name}
header for each metadata item (for each{name}
) that you want to add or update. -
X-Container-Read(optional): string
Sets a container access control list (ACL) that grants read access.
To set the container read ACL:
$ curl -X {PUT|POST} -i -H 'X-Auth-Token: TOKEN' -H \
For example:'X-Container-Read: ACL' STORAGE_URL/CONTAINER
$ curl -X PUT -i \
In the command, specify the ACL in the-H 'X-Auth-Token: 0101010101' \
-H 'X-Container-Read: .r:*' \
https://foo.storage.oraclecloud.com/v1/myservice-bar/FirstContainer
X-Container-Read
header, as follows:.r:*
—All referrers..r:example.com,swift.example.com
—Comma-separated list of referrers..rlistings
—Container listing access.
-
X-Container-Write(optional): string
Sets an ACL that grants write access.
-
X-Worm-Expiration-Days(optional): integer
Minimum Value:
1
Minimum number of days an object, once uploaded, must reside in a container before it can be overwritten with a PUT or POST or deleted.
Response
- application/json
201 Response
-
Content-Length: integer
Minimum Value:
0
If the operation succeeds, this value is zero (0). If the operation fails, this value is the length of the error text in the response body. -
Content-Type: string
If the operation fails, this value is the MIME type of the error text in the response body.
-
Date: string(date-time)
The transaction date and time.
The date and time stamp format is ISO 8601:
CCYY-MM-DDThh:mm:ss±hh:mm
For example,2015-08-27T09:49:58-05:00
.The
±hh:mm
value, if included, is the time zone as an offset from UTC. In the previous example, the offset value is-05:00
.A
null
value indicates that the token never expires. -
X-Timestamp: integer(timestamp)
Minimum Value:
0
The date and time in UNIX Epoch time stamp format when the account, container, or object was initially created as a current version.For example,
1440619048
is equivalent toMon, Wed, 26 Aug 2015 19:57:28 GMT
. -
X-Trans-Id: string(uuid)
A unique transaction identifier for this request. Your service provider might need this value if you report a problem.
202 Response
Note that this is consistent with actual OpenStack Swift behavior, but not with the documented OpenStack Swift return code of 204.
-
Content-Length: integer
Minimum Value:
0
If the operation succeeds, this value is zero (0). If the operation fails, this value is the length of the error text in the response body. -
Content-Type: string
If the operation fails, this value is the MIME type of the error text in the response body.
-
Date: string(date-time)
The transaction date and time.
The date and time stamp format is ISO 8601:
CCYY-MM-DDThh:mm:ss±hh:mm
For example,2015-08-27T09:49:58-05:00
.The
±hh:mm
value, if included, is the time zone as an offset from UTC. In the previous example, the offset value is-05:00
.A
null
value indicates that the token never expires. -
X-Timestamp: integer(timestamp)
Minimum Value:
0
The date and time in UNIX Epoch time stamp format when the account, container, or object was initially created as a current version.For example,
1440619048
is equivalent toMon, Wed, 26 Aug 2015 19:57:28 GMT
. -
X-Trans-Id: string(uuid)
A unique transaction identifier for this request. Your service provider might need this value if you report a problem.
400 Response
-
Content-Length: integer
Minimum Value:
1
This value is the length of the error text in the response body. -
Content-Type: string
This value is the MIME type of the error text in the response body.
-
Date: string(date-time)
The transaction date and time.
The date and time stamp format is ISO 8601:
CCYY-MM-DDThh:mm:ss±hh:mm
For example,2015-08-27T09:49:58-05:00
.The
±hh:mm
value, if included, is the time zone as an offset from UTC. In the previous example, the offset value is-05:00
.A
null
value indicates that the token never expires. -
X-Trans-Id: string(uuid)
A unique transaction identifier for this request. Your service provider might need this value if you report a problem.
401 Response
-
Content-Length: integer
Minimum Value:
0
The length of the error text in the response body. -
Content-Type: string
The MIME type of the error text in the response body.
403 Response
- A data center has not been selected for your service in Oracle Cloud My Services.
- The request was sent to an incorrect data center. For example, the data center for your service is Chicago (us2), but the request was sent to the URL corresponding to the Ashburn (us6) data center.
- You don't have the required permission to perform the operation on the specified container. For example, there may be a change in the roles assigned to your user or the access privileges defined for the container specified in the request.
- Violating a container or object level WORM policy by trying to PUT, POST, or DELETE an object that has not expired or trying to update an existing container level WORM policy.
-
Content-Length: integer
Minimum Value:
0
The length of the error text in the response body. -
Content-Type: string
The MIME type of the error text in the response body.
Examples
cURL Command
-
Account name:
acme
-
REST Endpoint URL:
https://acme.storage.oraclecloud.com/v1/Storage-acme
-
REST Endpoint (Permanent) URL:
https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365
-
Identity Domain:
myDomain
obtained from My Services dashboard
Note:
The REST Endpoint (Permanent) URL is displayed for the accounts created after November 2017.Creating a Container
The following example shows how to create a container in your account in Oracle Cloud Infrastructure Object Storage Classic by submitting a PUT request.
-
Using the REST Endpoint URL obtained from the REST Endpoint field in the My Services dashboard:
curl -v -X PUT \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ https://acme.storage.oraclecloud.com/v1/Storage-acme/FirstContainer
The following is a sample response of this command:
HTTP/1.1 201 Created Date: Fri, 06 Mar 2015 10:34:20 GMT Content-Length: 0 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx23a1084b8c674fdeae8d4-0054f982ac
-
Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field in the My Services dashboard:
Note:
This cURL command example applies to the accounts created after November 2017.curl -v -X PUT \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365/FirstContainer
The following is a sample response of this command:
HTTP/1.1 201 Created Date: Fri, 06 Mar 2015 10:34:20 GMT Content-Length: 0 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx23a1084b8c674fdeae8d4-0054f982ac
Bulk-Creating Objects in a Container
The following example shows how to create multiple objects in an existing container by uploading an archive file, which may contain multiple directories. An object is created for each file in the uploaded archive bundle. Empty directories in the archive bundle are ignored. The name of each created object represents its full directory path.
-
Create a local archive (
.tar
,.tar.gz
, ortar.bz2
) of the files and directories to be stored.Here's a sample archive file:$ tar -tzf bulk-test.tar.gz file1 folder1/file2 folder1/file3 folder1/subfolder1 folder1/subfolder2/file4 folder2/file5
-
Upload the archive file.
Specify the archive type by using the
extract-archive
request parameter.cURL Command
-
Using the REST Endpoint URL obtained from the REST Endpoint field in the My Services dashboard:
curl -v -X PUT \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ "https://acme.storage.oraclecloud.com/v1/Storage-acme/BulkContainer?extract-archive=tar.gz" -T bulk-test.tar.gz
-
Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field in the My Services dashboard:
Note:
This cURL command example applies to the accounts created after November 2017.curl -v -X PUT \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ "https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365/BulkContainer?extract-archive=tar.gz" -T bulk-test.tar.gz
The response indicates the number of files created and errors, if any.
Sample Response
Response Status: 201 Created Number Files Created: 5 Errors:
An object is created for each file in the uploaded archive bundle. Empty directories in the archive bundle are ignored. The name of each created object represents its full directory path.
-
-
Verify the bulk operation by sending a
GET
request.-
Using the REST Endpoint URL obtained from the REST Endpoint field in the My Services dashboard:
curl -X GET \ -H "X-Auth-Token: AUTH_tk1269e2899ecbc86b4402167c94bad149" \ "https://acme.storage.oraclecloud.com/v1/Storage-acme/BulkContainer"
-
Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field in the My Services dashboard:
Note:
This cURL command example applies to the accounts created after November 2017.curl -X GET \ -H "X-Auth-Token: AUTH_tk1269e2899ecbc86b4402167c94bad149" \ "https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365/BulkContainer"
Sample Response
file1 folder1/file2 folder1/file3 folder1/subfolder2/file4 folder2/file5
-