Operations (sample payloads)

Main operations

Delete Multiple Objects

Delete multiple objects in an S3 bucket. Sample Input

{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-example-bucket",
    "object_keys": [
        {
            "Key": "documents/report2023.pdf"
        },
        {
            "Key": "images/profile.jpg"
        },
        \{
            "Key": "backups/database_20230515.sql",
            "VersionId": "3HL4kqtJvjVBH40Nrjfkd"
        \}
    ]
}

Sample Output

{}

Delete Object

Delete an object in an S3 bucket. Sample Input Sample Output

{
    "success": true
}

Get bucket location

Get the region of specified bucket. Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "auto",
    "bucket_name": "my-example-bucket"
\}

Sample Output

{
    "result": "us-west-2"
}

Get Object

Get an object from an S3 bucket. Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-bucket",
    "object_path": "documents/report.pdf"
\}

Sample Output

{
    "file": \{
        "name": "report.pdf",
        "url": "https://my-bucket.s3.us-west-2.amazonaws.com/documents/report.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20230515%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230515T120000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
        "mime_type": "application/pdf",
        "expires": 1684152000
    \}
}

Get Object's Signed URL

Get an object's signed url from an S3 bucket. Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-example-bucket",
    "object_path": "documents/report.pdf",
    "expires_seconds": 3600,
    "range_from": 0,
    "range_to": 1048576
\}

Sample Output

{
    "file": \{
        "name": "report.pdf",
        "url": "https://my-example-bucket.s3.us-west-2.amazonaws.com/documents/report.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20230515%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230515T120000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
        "expires": 1684152000
    \}
}

Head Object

Get object metadata Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-bucket",
    "object_path": "documents/report.pdf"
\}

Sample Output

{
    "AcceptRanges": "bytes",
    "LastModified": "2023-05-15T14:30:00.000Z",
    "ContentLength": 2048576,
    "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
    "ContentType": "application/pdf",
    "Metadata": \{
        "sourcetype": "pdf",
        "hostname": "example.com",
        "s3_filename_prefix": "documents",
        "s3_filename": "report.pdf",
        "type": "document",
        "s3_filename_suffix": "pdf",
        "datatype": "binary",
        "s3_folder": "documents"
    \}
}

List Bucket Objects

List objects in an S3 bucket. Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "bucket_name": "my-bucket",
    "prefix": "documents/",
    "delimiter": "/",
    "max_keys": 1000
\}

Sample Output

{
    "IsTruncated": true,
    "Contents": [
        {
            "Key": "documents/file1.txt",
            "LastModified": "2023-05-15T10:30:00.000Z",
            "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
            "Size": 1024,
            "StorageClass": "STANDARD",
            "Owner": \{
                "DisplayName": "JohnDoe",
                "ID": "1234567890abcdef1234567890abcdef12345678901234567890abcdef"
            \}
        },
        {
            "Key": "documents/file2.pdf",
            "LastModified": "2023-05-16T14:45:00.000Z",
            "ETag": "\"f2ca1bb6c7e907d06dafe4687e579fce\"",
            "Size": 2048,
            "StorageClass": "STANDARD",
            "Owner": \{
                "DisplayName": "JohnDoe",
                "ID": "1234567890abcdef1234567890abcdef12345678901234567890abcdef"
            \}
        }
    ],
    "Name": "my-bucket",
    "Prefix": "documents/",
    "MaxKeys": 1000,
    "CommonPrefixes": [
        {
            "Prefix": "documents/subfolder1/"
        },
        {
            "Prefix": "documents/subfolder2/"
        }
    ],
    "KeyCount": 4,
    "NextContinuationToken": "1ueGcxLPRx1Tr/XYExHnhbYLgveDs2J/wm36Hy4vbOwM="
}

List Buckets

List all the buckets available for your authentication. Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2"
\}

Sample Output

{
    "Buckets": [
        \{
            "Name": "my-bucket-1",
            "CreationDate": "2023-05-15T10:30:00.000Z"
        \},
        \{
            "Name": "my-bucket-2",
            "CreationDate": "2023-05-16T14:45:00.000Z"
        \},
        \{
            "Name": "backup-bucket",
            "CreationDate": "2023-05-17T09:00:00.000Z"
        \}
    ]
}

Put Object (File)

Put an object in an S3 bucket from an existing Tray.io file object. Sample Input

{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-bucket",
    "object_path": "uploads/document.pdf",
    "file": \{
        "name": "document.pdf",
        "url": "https://example.com/files/document.pdf",
        "mime_type": "application/pdf"
    \},
    "acl": "private",
    "expires": "2023-12-31T23:59:59Z",
    "meta_data": [
        \{
            "key": "project",
            "value": "annual-report"
        \},
        \{
            "key": "department",
            "value": "finance"
        \}
    ]
}

Sample Output

{
    "file": \{
        "name": "document.pdf",
        "url": "https://my-bucket.s3.us-west-2.amazonaws.com/uploads/document.pdf",
        "mime_type": "application/pdf",
        "expires": 1704067199
    \}
}

Put Object (Text)

Put an object in an S3 bucket from some UTF-8 text content and a mime type. Sample Input

{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-example-bucket",
    "object_path": "documents/example.json",
    "content": "\{\n\t\"name\": \"John Doe\",\n\t\"age\": 30,\n\t\"city\": \"New York\"\n\}",
    "mime_type": "application/json",
    "acl": "private",
    "expires": "2023-12-31T23:59:59Z"
}

Sample Output

{
    "file": \{
        "name": "documents/example.json",
        "url": "https://my-example-bucket.s3.us-west-2.amazonaws.com/documents/example.json",
        "mime_type": "application/json",
        "expires": 1704067199
    \}
}

Put Object ACL

Put an existing-object Access Control List Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2",
    "bucket_name": "my-bucket",
    "object_path": "documents/report.pdf",
    "acl": "public-read"
\}

Sample Output

{}

DDL operations

List buckets (DDL)

Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping


Sample Input

\{
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    "region": "us-west-2"
\}

Sample Output

{
    "buckets": [
        \{
            "Name": "my-bucket-1",
            "CreationDate": "2023-05-15T10:00:00.000Z"
        \},
        \{
            "Name": "my-bucket-2",
            "CreationDate": "2023-05-16T14:30:00.000Z"
        \},
        \{
            "Name": "my-backup-bucket",
            "CreationDate": "2023-05-17T09:15:00.000Z"
        \}
    ],
    "Owner": \{
        "DisplayName": "my-aws-account",
        "ID": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0"
    \}
}

Was this page helpful?