NavigationContentFooter
Jump toSuggest an edit

Understanding Object Storage object operations

Reviewed on 04 July 2024Published on 13 September 2018

DeleteObject

This operation allows you to remove the null version (if available) of an object and inserts a delete marker, which becomes the latest version of the object.

If there is no null version, no object is removed.

Note

If the operation is successful, no output will be returned.

Sample request

DELETE /file.txt HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20190411T080553Z
Authorization: authorization string

CLI command

aws s3api delete-object --bucket BucketName --key ObjectName
Note

If bucket versioning is enabled, the output will contain the version ID of the delete marker.

DeleteObjects

This operation allows you to delete multiple objects in a single request (up to 1,000).

Sample request

POST /?delete HTTP/1.1
Host: bucket.s3.fr-par.scw.cloud
Content-md5: IDCi4XsSBVpFGHtK7bEVag==
x-amz-date: 20220406T122013Z
Authorization: authorization string
<Delete xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Object>
<Key>object1.jpg</Key>
<VersionId>1554970190808057</VersionId>
</Object>
<Object>
<Key>object2.jpg</Key>
</Object>
</Delete>

Sample response

HTTP/1.1 200 OK
x-amz-id-2: tx4b4bd55643874b48b1e87-00624d857d
x-amz-request-id: tx4b4bd55643874b48b1e87-00624d857d
date: Wed, 06 Apr 2022 12:20:13 GMT

DeleteObjectTagging

This operation allows you to delete a tag set from a specified object.

Note

If the operation is successful, no output will be returned.

Sample request

DELETE /Sampleobject?tagging HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
Date: Wed, 13 Mar 2019 12:00:00 GMT
Authorization: authorization string

GetObject

This operation allows you to retrieve objects from Scaleway Object Storage.

Sample request

GET /Sample.txt HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20190411T081116Z
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
Date: Thu, 11 Apr 2019 08:11:16 GMT
x-amz-request-id: tx00000000000000279f46e-005963d003-1268c-ams1
Content-Type: text/plain
Content-Length: 14
Accept-Ranges: bytes
VersionId: 1554970190808057
Last-Modified: Thu, 11 Apr 2019 08:09:50 GMT
Etag: d41d8cd98f00b204e9800998ecf8427e
Connection: close

CLI command

aws s3api get-object --bucket BucketName --key dir/ObjectNameLocation ObjectName
Note

The name of the output file must be the last parameter in the command.

GetObjectAcl

This operation allows you to return the access control list (ACL) of an object.

Sample request

GET /test.html?acl HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud.com
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20190411T081550Z
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
Date: Thu, 11 Apr 2019 08:15:51 GMT
x-amz-request-id: tx0e22d038acce4d35b0b07-005caef7b6
Content-Type: text/html; charset=UTF-8
Content-Length: 698
Connection: close
<?xml version='1.0' encoding='UTF-8'?>
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>04dcf44f-a6ca-4e69-a74c-f0c557d87d79:a6a05c73-fa53-46a4-9ea1-e53b4f62552<ID>
<DisplayName>04dcf44f-a6ca-4e69-a74c-f0c557d87d79:04dcf44f-a6ca-4e69-a74c-f0c557d87d79</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>04dcf44f-a6ca-4e69-a74c-f0c557d87d79:04dcf44f-a6ca-4e69-a74c-f0c557d87d79< ID>
<DisplayName>04dcf44f-a6ca-4e69-a74c-f0c557d87d79:04dcf44f-a6ca-4e69-a74c-f0c557d87d79</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>

CLI command

aws s3api get-object-acl --bucket BucketName --key ObjectName

GetObjectLockConfiguration

This operation returns the lock configuration.

Sample request

GET /lockedbucket?object-lock HTTP/1.1

Sample response

<ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>COMPLIANCE</Mode>
<Days>1000</Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>

GetObjectTagging

This operation returns the tag set of the specified object.

Sample request

GET /Sample-object?tagging HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
Date: Wed, 13 Mar 2019 12:00:00 GMT
Authorization: authorization string

Sample response

<?xml version="1.0" encoding="UTF-8"?>
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<TagSet>
<Tag>
<Key>Object Description</Key>
<Value>Company Presentation</Value>
</Tag>
<Tag>
<Key>Client</Key>
<Value>Scaleway</Value>
</Tag>
</TagSet>
</Tagging>

HeadObject

The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you’re only interested in an object’s metadata. To use HEAD, you must have READ access to the object.

Sample request

HEAD /myfile.txt HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Thu, 11 Apr 2019 08:25:56 GMT
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
x-amz-id-2: tx8cd3dff03f0f4be7aee3c-005caefb1e
x-amz-request-id: tx8cd3dff03f0f4be7aee3c-005caefb1e
Date: Thu, 11 Apr 2019 08:25:56 GMT
Last-Modified: Thu, 11 Apr 2019 08:15:33 GMT
ETag: d41d8cd98f00b204e9800998ecf8427e
Content-Length: 689
Content-Type: text/plain
Connection: close

CLI command

aws s3api head-object --bucket BucketName --key ObjectName

CreateMultipartUpload

Multipart uploads allow you to upload a single object as a set of parts. Each part is a contiguous portion of the object’s data. You can upload these object parts independently and in any order. If transmission of any part fails, you can retransmit that part without affecting other parts. After all parts of your object are uploaded, Scaleway Object Storage assembles these parts and creates the object.

Tip

Check out our multipart uploads documentation page for more information.

Sample request

This operation initiates a multipart upload for the Sample-object object.

POST /Sample-object?uploads HTTP/1.1
Host: bucketname.s3.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Mon, 1 Nov 2018 12:34:56 GMT
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
x-amz-id-2: tx4464d513d86f498c8b7ad-005caefda8
x-amz-request-id: tx4464d513d86f498c8b7ad-005caefda8
Date: Mon, 1 Nov 2018 12:34:56 GMT
Content-Length: 197
Connection: keep-alive
<?xml version="1.0" encoding="UTF-8"?>
<InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Bucket>Sample-bucket</Bucket>
<Key>Sample-object</Key>
<UploadId>NjJmNmJhYTEtNjk1Ny00ZjJlLWJhYWUtMDg5YWMzNzFjYjQ3</UploadId>
</InitiateMultipartUploadResult>

CLI command

aws s3api create-multipart-upload --bucket my-bucket --key 'multipart/01'

OPTIONS object

The OPTIONS operation allows a browser to send a preflight request to Object Storage to determine if the actual request is supported with the specific origin, HTTP method and headers.

When a browser sends this request, Object Storage evaluates the rules that are defined in the CORS configuration.

Sample request

OPTIONS /Sampleobject HTTP/1.1
Host: bucketname.s3.nl-ams.scw.cloud
Origin: http://www.Sample.com
Access-Control-Request-Method: PUT

Sample response

HTTP/1.1 200 OK
Date: Mon, 19 Mar 2019 11:38:17 GMT
Access-Control-Allow-Origin: http://www.Sample.com
Access-Control-Allow-Methods: PUT
Access-Control-Expose-Headers: x-amz-request-id

POST object

This operation allows you to add an object to a specified bucket using HTML forms. POST is an alternate form of PUT that enables browser-based uploads as a way of putting objects in buckets.

Note

If you want to learn more about this request, check out the POST Object documentation page.

Sample request

POST /file.txt HTTP/1.1
Content-Length: 4
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Thu, 11 Apr 2019 08:28:57 GMT
Authorization: authorization string
Content-Type: text/plain
Expect: the 100-continue HTTP status code
ObjectContent

Sample response

HTTP/1.1 100 Continue
HTTP/1.1 200 OK
x-amz-id-2: txd16e07b7d52a46f08eb62-005caef22f
x-amz-request-id: txd16e07b7d52a46f08eb62-005caef22f
x-amz-version-id: default
Date: Thu, 11 Apr 2019 08:28:58 GMT
ETag: d41d8cd98f00b204e9800998ecf8427e
Content-Length: 0
Connection: close

PutObject

This operation allows you to add an object to a bucket.

Sample request

PUT /Sample.txt HTTP/1.1
Content-Length: 14
Content-Type: text/plain
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20190411T075215Z
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
Date: Thu, 11 Apr 2019 07:52:15 GMT
x-amz-request-id: txd16e07b7d52a46f08eb62-005caef22f
Content-Length: 0
Accept-Ranges: bytes
Last-Modified: Thu, 11 Apr 2019 07:52:15 GMT
Etag: d41d8cd98f00b204e9800998ecf8427e
Connection: close

CLI command

aws s3api put-object --bucket BucketName --key dir-1/ObjectName --body ObjectName
Note

To define the storage class of the object directly upon creation, use the --storage-class <class> option with awscli or add the x-amz-storage-class: <class> header when using the Amazon S3 API. You can specify one of the following classes: STANDARD, ONEZONE_IA, GLACIER. Example: x-amz-storage-class: ONEZONE_IA.

If no class is specified, the object is created as STANDARD by default.

PutObjectAcl

This operation allows you to use the ACL subresource to set the access control list (ACL) permissions for an object that already exists in a bucket. The --acl subcommand possible values are:

  • private
  • public-read
  • public-read-write
  • authenticated-read
  • bucket-owner-read
  • bucket-owner-full-control

Sample request

PUT /demo.jpg?acl HTTP/1.1
acl=
host:bucket.s3.nl-ams.scw.cloud
x-amz-acl:public-read
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20190411T085423Z

Sample response

HTTP/1.1 200 OK
Date: Thu, 11 Apr 2019 08:54:23 GMT
x-amz-request-id: txf2d890e745114dc5ace62-005caf03f1
Content-Type: application/xml
Content-Length: 0
Connection: close

CLI command

aws s3api put-object-acl --bucket BucketName --key file.txt --acl private

PutObjectCopy

This operation allows you to create a new object from an existing one.

Sample request

This Sample copies my-image.jpg into the bucket newbucket, with the key name my-second-image.jpg.

PUT /my-second-image.jpg HTTP/1.1
Host: oldbucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Thu, 11 Apr 2019 08:41:12 GMT
x-amz-copy-source: /bucket/my-image.jpg
Authorization: authorization string

Sample response

HTTP/1.1 200 OK
x-amz-id-2: tx4464d513d86f498c8b7ad-005caefda8
x-amz-request-id: tx4464d513d86f498c8b7ad-005caefda8
Date: Thu, 11 Apr 2019 08:41:12 GMT
Connection: close
<CopyObjectResult>
<LastModified>2019-04-11Z08:33:10</LastModified>
<ETag>f3c8f2ac362e890999d282db06a34469</ETag>
</CopyObjectResult>

CLI command

aws s3api copy-object --copy-source bucket-1/test.txt --key test.txt --bucket bucket-2

PutObjectLockConfiguration

This operation applies the lock configuration on a bucket.

Note

If the operation is successful, no output will be returned.

Sample request

PUT /lockedbucket?object-lock HTTP/1.1
<ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<ObjectLockEnabled>Enabled</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Mode>COMPLIANCE</Mode>
<Days>1000</Days>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>

PutObjectTagging

This operation allows you to add a tag set to an existing object in a bucket.

Sample request

PutObject-key?tagging HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
Content-Length: length
Content-MD5: 88jyrDYuiQmZ0oLbBqNEaQ==
x-amz-date: 20190313T091956Z
Authorization: authorization string
<Tagging>
<TagSet>
<Tag>
<Key>Object Description</Key>
<Value>Company Presentation</Value>
</Tag>
<Tag>
<Key>Client</Key>
<Value>Scaleway</Value>
</Tag>
</TagSet>
</Tagging>

Sample response

HTTP/1.1 200 OK
x-amz-id-2: tx9b476790a39c409d8b029-005caf01d5
x-amz-request-id: tx9b476790a39c409d8b029-005caf01d5
Date: Wed, 13 Mar 2019 09:20:19 GMT

RestoreObject

This call moves an object back to the STANDARD storage class for the specified number of days. It triggers a background restore job on the Object Storage service. The status of the restore is available in the x-amz-restore response header of the HeadObject call.

Sample request

POST /object?restore HTTP/1.1
Host: bucket.s3.fr-par.scw.cloud
x-amz-date: 20220406T122555Z
Authorization: authorization string
<?xml version="1.0" encoding="UTF-8"?>
<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Days>15</Days>
</RestoreRequest>

Sample response

HTTP/1.1 202 Accepted
x-amz-id-2: txa1c547b9e2fb41d5b9cc2-00624d86d3
x-amz-request-id: txa1c547b9e2fb41d5b9cc2-00624d86d3
Date: Wed, 06 Apr 2022 12:26:06 GMT
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway