Creating a Single Object

Objects must be created within a container. Objects can be created by uploading files and/or specifying metadata.

Any user with the Service Administrator role or a role that is specified in the X-Container-Write ACL of the container can perform this task. You can create objects in a standard or archive container.

You can create objects in a container by using the following interfaces:
Interface Resources

Web Console

(Not available on Oracle Cloud at Customer)

See Creating a Single Object Using the Web Console.

RESTful API

See

Java Library

See storeObject in Java API Reference for Oracle Cloud Infrastructure Object Storage Classic.

File Transfer Manager API

See upload in Java API Reference for Oracle Cloud Infrastructure Object Storage Classic File Transfer Manager.

File Transfer Manager CLI

See Uploading an Object in Command-Line Reference for Oracle Cloud Infrastructure Object Storage Classic.

For the steps to upload multiple objects in a single operation, see Uploading Multiple Objects in a Single Operation.

Creating a Single Object Using the Web Console

(Not available on Oracle Cloud at Customer)
  1. Sign in to the Oracle Cloud Infrastructure Object Storage Classic console.
  2. Select the container in which you would like to upload an object.
  3. Select Enable Upload and Download in the Container Information pane.

    The following message appears:

    In order to upload and download objects to the current container, this application must enable Cross-Origin Resource Sharing (CORS) for this domain domainName.
    You can disable this setting at anytime. 
    Would you like to continue?
  4. Click OK to enable Cross-Origin Resource Sharing (CORS).

    The Upload Objects button is enabled.

    Note:

    You can disable CORS in the container at any time. Select Disable Upload and Download in the Container Information pane to disable CORS. You can’t upload objects to the container if CORS is disabled.
  5. Click Upload Objects and select the object to be uploaded.

    Note:

    Ensure that the object name complies with the input restrictions mentioned in Character Restrictions.

    The upload progress and upload status of the object is displayed.

    After the object is uploaded, the object details (Last Modified and Size) are displayed.

Creating a Single Object Using the REST API

cURL Command Syntax

curl -v -X PUT \
     -H "X-Auth-Token: token" \
     -T file \
     accountURL/containerName/objectName

Note:

When you send a REST API request to Oracle Cloud Infrastructure Object Storage Classic, all non-ASCII characters in container names, object names and metadata values must be URL-encoded. For example, my container should be encoded as my%20container, where %20 is the HTML encoding for the space character. Similarly, my Über Container should be encoded as my%20%C3%9Cber%20Container, where %20 represents the space character and %C3%9C is the Ü character.

To schedule automatic deletion of objects, include the X-Delete-After or X-Delete-At header. See Scheduling Automatic Deletion of Objects.

HTTP Response Codes

cURL Command Examples

Sample Cloud account with the following details:
  • 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

    Note:

    The REST Endpoint (Permanent) URL is displayed for the accounts created after November 2017.
  • Using the REST Endpoint URL obtained from the REST Endpoint field:
    curl -v -X PUT \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         -T myFile.txt \
         https://acme.storage.oraclecloud.com/v1/Storage-acme/FirstContainer/myObject
    

    The following is an example of the output of this command:

    > PUT /v1/Storage-acme/FirstContainer/myObject HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: acme.storage.oraclecloud.com
    > Accept: */*
    > X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b
    > Content-Length: 23
    > Expect: 100-continue
    >
    * Done waiting for 100-continue
    < HTTP/1.1 201 Created
    < Date: Mon, 09 Mar 2015 11:26:57 GMT
    < Last-Modified: Mon, 09 Mar 2015 11:26:58 GMT
    < Content-Length: 0
    < Etag: 846fa9d298be05e5f598703f0c3d6f51
    < Content-Type: text/html; charset=UTF-8
    < X-Trans-Id: tx2a97f34acb7048679ae3b-0054fd8381
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Content-Language: en
    
  • Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field:

    Note:

    This cURL command example applies to the accounts created after November 2017.
    curl -v -X PUT \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         -T myFile.txt \
         https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365/FirstContainer/myObject
    

    The following is an example of the output of this command:

    > PUT /v1/Storage-7b16fede61e1417ab83eb52e06f0e365/FirstContainer/myObject HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com
    > Accept: */*
    > X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b
    > Content-Length: 23
    > Expect: 100-continue
    >
    * Done waiting for 100-continue
    < HTTP/1.1 201 Created
    < Date: Mon, 09 Mar 2015 11:26:57 GMT
    < Last-Modified: Mon, 09 Mar 2015 11:26:58 GMT
    < Content-Length: 0
    < Etag: 846fa9d298be05e5f598703f0c3d6f51
    < Content-Type: text/html; charset=UTF-8
    < X-Trans-Id: tx2a97f34acb7048679ae3b-0054fd8381
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Content-Language: en