Object#

Basic operations with objects.

PutObject#

Adds an object to the bucket. To perform this operation, write access to the bucket is required. In the upload request, you can set access rights (ACL), user metadata (x-amz-meda-*), and other parameters.

Sample Request#

Request
PUT /bucket_1/picture.png HTTP/1.1
Host: storage.cloud.croc.ru
Expires: Sat, 15 Nov 2025 00:00:00 GMT
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220530T100558Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=expires;host;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-meta-owner, Signature=f14cb0ccf36e83ffeec9068ef6ff66df7eb16058ca2765f493699130755c08da
Content-Type: image/png
Content-Length: 22

"<file contents here>"

Sample Response#

Response
HTTP/1.1 200 OK
content-length: 0
etag: "8867b8c5ef7d69f34a427e7d2187e0f2"
x-amz-version-id: bunRaQM-7JHNd3yUAjMmS8iUJB.4hyI
x-amz-request-id: tx000000000000005941c5b-006294976f-4017b271-default
date: Mon, 30 May 2022 10:07:44 GMT

Sample Request (with object encryption)#

Adds an object to the bucket and encrypts it. Data is encrypted when they are written to disk and stored in encrypted form.

CROC Cloud supports SSE-C encryption, where AES-256 is used as the encryption algorithm. When uploading an object, you must specify a 256-bit base64-encoded encryption key. In addition, together with the key, you must pass its 128-bit MD5 hash — also base64-encoded. To calculate the hash, use the original key rather than its base64-encoded version.

When downloading an encrypted object and performing other operations with it, you must specify the encryption parameters.

Request
PUT /bucket1/secret.txt HTTP/1.1
Host: storage.cloud.croc.ru
x-amz-server-side-encryption-customer-algorithm: AES256
x-amz-server-side-encryption-customer-key: U2hWbVlxM3Q2dzl6JEMmRilKQE1jUWZUalduWnI0dTc=
x-amz-server-side-encryption-customer-key-MD5: 1J+naYvPxIshFbjdz2cU5Q==
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220530T165351Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-server-side-encryption-customer-algorithm;x-amz-server-side-encryption-customer-key;x-amz-server-side-encryption-customer-key-md5, Signature=bd31e7aa50608595deb70c05ddb03f14e6b47a640b9fbab37de429d0355c8800
Content-Type: text/plain
Content-Length: 22

"<file contents here>"

Sample Response#

Response
HTTP/1.1 200 OK
content-length: 0
etag: "dff23456a91215d7153f85a7c127aaa9"
accept-ranges: bytes
x-amz-server-side-encryption-customer-algorithm: AES256
x-amz-server-side-encryption-customer-key-MD5: 1J+naYvPxIshFbjdz2cU5Q==
x-amz-request-id: tx000000000000005d6a08c-006294f69e-40173986-default
date: Mon, 30 May 2022 16:53:51 GMT

PutObjectTagging#

Sets object tags. You can set up to 10 tags in total.

Sample Request#

Request
 PUT /bucket1/instruction.txt?tagging=null HTTP/1.1
 Host: storage.cloud.croc.ru
 X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3
 X-Amz-Date: 20220531T143433Z
 Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220531/{region}/s3/aws4_request, SignedHeaders=expires;host;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-meta-owner, Signature=22e250bc3d1bc57cc0cc2739eb4cb5124d9c4e710a3ae3ff4c945d936709d6c5
 Content-Type: text/plain
 Content-Length: 247

 <Tagging>
    <TagSet>
       <Tag>
          <Key>Writer</Key>
         <Value>IvanIvanov</Value>
       </Tag>
       <Tag>
          <Key>Content</Key>
          <Value>Instruction</Value>
       </Tag>
    </TagSet>
</Tagging>

Sample Response#

Response
HTTP/1.1 200 OK
x-amz-request-id: tx000000000000007052615-0062962937-41e627a3-default
content-type: application/xml
content-length: 0
date: Tue, 31 May 2022 14:41:59 GMT

GetObject#

Retrieves an object from the bucket. If the object version is not specified, then the latest (null) object version is downloaded.

To perform the operation, you need read access to the object. If read access is granted to anonymous users, then the Authorization header is not required.

Besides the object itself, the response headers return information about the object, such as size, last modification date, retention time, etc.

Sample Request#

Request
GET /bucket_1/picture.png HTTP/1.1
Host: storage.cloud.croc.ru
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220530T155617Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=ede3ccb967783eb3ef8cc26c3c83c812ff9ea191c27217d7b5d7bf6f60d15904

Sample Response#

Response
HTTP/1.1 200 OK
content-length 394026
accept-ranges: bytes
last-modified: Mon, 30 May 2022 10:07:44 GMT
x-amz-version-id: bunRaQM-7JHNd3yUAjMmS8iUJB.4hyI
x-rgw-object-type: Normal
etag: "8867b8c5ef7d69f34a427e7d2187e0f2"
expires: Sat, 15 Nov 2025 00:00:00 GMT
x-amz-request-id: tx000000000000005b40ab7-006294ca8e-4017b271-default
content-type: image/png
date: Mon, 30 May 2022 15:56:15 GMT

"<file contents here>"

GetObjectTagging#

Returns object tags.

Sample Request#

Request
GET /bucket1/instruction.txt?tagging=null HTTP/1.1
Host: storage.cloud.croc.ru
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220531T144851Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220531/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=474a622a1017221d50e6b50b87b3cbcfd1719a10b61d4d5b4e9595f7536880e6

Sample Response#

Response
HTTP/1.1 200 OK
x-amz-request-id: tx000000000000003d54612-0062962ad3-41e5801e-default
content-type: application/xml
content-length: 226
date: Tue, 31 May 2022 14:48:51 GMT

<?xml version="1.0" encoding="UTF-8"?>
<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <TagSet>
        <Tag>
            <Key>Content</Key>
            <Value>Instruction</Value>
        </Tag>
        <Tag>
            <Key>Writer</Key>
            <Value>IvanIvanov</Value>
        </Tag>
    </TagSet>
</Tagging>

HeadObject#

Returns object information.

The request allows you to get the same object information as the GetObject action without downloading the object itself.

Sample Request#

Request
HEAD /bucket_1/picture.png HTTP/1.1
Host: storage.cloud.croc.ru
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220530T162749Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=ca990478f9baef5daefd7f062d3223e54dadb970124fbfc4c2d1bf8aeb2cd12d

Sample Response#

Response
HTTP/1.1 200 OK
content-length 394026
accept-ranges: bytes
last-modified: Mon, 30 May 2022 10:07:44 GMT
x-amz-version-id: bunRaQM-7JHNd3yUAjMmS8iUJB.4hyI
x-rgw-object-type: Normal
etag: "8867b8c5ef7d69f34a427e7d2187e0f2"
expires: Sat, 15 Nov 2025 00:00:00 GMT
x-amz-request-id: tx000000000000005b40ab7-006294ca8e-4017b271-default
content-type: image/png
date: Mon, 30 May 2022 15:56:15 GMT

CopyObject#

Copies an object from one bucket to another.

To perform this operation, the write access to the target bucket is required. The source object and bucket names are passed in the x-amz-copy-source header. You can set access rights (ACL), user metadata (x-amz-meda-*), and other parameters for the copied object.

Sample Request#

Copies the object picture1.png from the bucket bucket1 to the bucket bucket2 and renames it to picture_new.png.

Request
PUT /bucket2/picture_new.png HTTP/1.1
Host: storage.cloud.croc.ru
x-amz-copy-source: /bucket1/picture1.png
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220530T133802Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=expires;host;x-amz-acl;x-amz-content-sha256;x-amz-copy-source;x-amz-date;x-amz-meta-owner, Signature=4b484c059df23b7fd6dcc45bf084494b0e002d420773b8ad0b38ec74ecf62c01
Content-Type: text/plain
Content-Length: 22

Sample Response#

Response
HTTP/1.1 200 OK
transfer-encoding: chunked
x-amz-request-id: tx000000000000005b40ab7-006294ca8e-4017b271-default
content-type: application-xml
date: Mon, 30 May 2022 13:45:50 GMT

<?xml version="1.0" encoding="UTF-8"?>
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <LastModified>2022-05-30T13:45:50.496Z</LastModified>
    <ETag>153f23962d0d3f983e9d961958d811e4</ETag>
</CopyObjectResult>

DeleteObjectTagging#

Deletes all object tags.

Sample Request#

Request
DELETE /bucket1/document.txt?tagging=null&versionId=csvHIfPUZHiuSlpVmCuFuhWmI-94J2k HTTP/1.1
Host: storage.cloud.croc.ru
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220606T143606Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220606/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=cff752f8fb54a499bdd6523757463bc39d029112027115ed10062062cbaebb3c

Sample Response#

Response
HTTP/1.1 204 No Content
x-amz-request-id: tx00000000000000f8b4201-00629e10d6-37d64f12-default
date: Mon, 06 Jun 2022 14:36:06 GMT

DeleteObject#

Deletes the latest (null) object version. You can also delete a specific object version by specifying its ID.

The deleted object is marked as deleted (the DeleteMarker value is set to True). If there is no null version (for example, it was deleted earlier, or such an object does not exist), then the request still completes successfully.

Sample Request#

Request
DELETE /bucket1/document1.docx HTTP/1.1
Host: storage.cloud.croc.ru
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220530T140113Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=5b53526ea569a1a8f4bc817e05cdd3cf30bbf7a35ee7aa5ee44eb245c1770ec9

Sample Response#

Response
HTTP/1.1 204 No Content
x-amz-version-id: null
x-amz-delete-marker: true
x-amz-request-id: tx000000000000005b40ab7-006294ca8e-4017b271-default
date: Mon, 30 May 2022 13:45:50 GMT

DeleteObjects#

Deletes the specified objects and their versions. Up to 1,000 objects and versions can be deleted in one operation.

When an object is deleted, its latest (null) version is deleted and a deletion marker (DeleteMarker) is added. To delete a specific version of an object, specify its ID. If the specified object is not found, the operation still completes successfully.

Sample Request#

Deletes an object and its version.

Request
POST /bucket1/?delete=null HTTP/1.1
Host: storage.cloud.croc.ru
X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3
X-Amz-Date: 20220530T150952Z
Authorization: AWS4-HMAC-SHA256 Credential=project:user@company/20220530/{region}/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=6c87858da60b39644da391cb324d806a6f2f547cbc86fbdb670c04e9cf017e6c
Content-Type: text/plain
Content-Length: 197

<Delete>
 <Object>
  <Key>text1.txt</Key>
 </Object>
 <Object>
   <Key>document1.docx</Key>
   <VersionId>TYdakjkQxax3CKlndqr8diCgEqjq8d7</VersionId>
 </Object>
</Delete>

Sample Response#

Response
HTTP/1.1 200 OK
transfer-encoding: chunked
x-amz-request-id: tx000000000000005c0c752-006294de40-4017b271-default
content-type: application/xml
date: Mon, 30 May 2022 13:45:50 GMT

<?xml version="1.0" encoding="UTF-8"?>
<DeleteResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Deleted>
    <Key>text1.txt</Key>
    <DeleteMarker>true</DeleteMarker>
    <DeleteMarkerVersionId>null</DeleteMarkerVersionId>
</Deleted>
    <Deleted>
        <Key>document1.docx</Key>
        <VersionId>TYdakjkQxax3CKlndqr8diCgEqjq8d7</VersionId>
    </Deleted>
</DeleteResult>