接口:PUTObject

简要概述

上传文件 官方文档

接口解析

请求语法

PUT /{object_key} HTTP/1.1

Host: {bucket}.{endpoint}

x-amz-acl: ACL
Cache-Control: CacheControl
Content-Disposition: ContentDisposition
Content-Encoding: ContentEncoding
Content-Language: ContentLanguage
Content-Length: ContentLength
Content-MD5: ContentMD5
Content-Type: ContentType
x-amz-sdk-checksum-algorithm: ChecksumAlgorithm
x-amz-checksum-crc32: ChecksumCRC32
x-amz-checksum-crc32c: ChecksumCRC32C
x-amz-checksum-sha1: ChecksumSHA1
x-amz-checksum-sha256: ChecksumSHA256
Expires: Expires
x-amz-grant-full-control: GrantFullControl
x-amz-grant-read: GrantRead
x-amz-grant-read-acp: GrantReadACP
x-amz-grant-write-acp: GrantWriteACP
x-amz-server-side-encryption: ServerSideEncryption
x-amz-storage-class: StorageClass
x-amz-website-redirect-location: WebsiteRedirectLocation
x-amz-server-side-encryption-customer-algorithm: SSECustomerAlgorithm
x-amz-server-side-encryption-customer-key: SSECustomerKey
x-amz-server-side-encryption-customer-key-MD5: SSECustomerKeyMD5
x-amz-server-side-encryption-aws-kms-key-id: SSEKMSKeyId
x-amz-server-side-encryption-context: SSEKMSEncryptionContext
x-amz-server-side-encryption-bucket-key-enabled: BucketKeyEnabled
x-amz-request-payer: RequestPayer
x-amz-tagging: Tagging
x-amz-object-lock-mode: ObjectLockMode
x-amz-object-lock-retain-until-date: ObjectLockRetainUntilDate
x-amz-object-lock-legal-hold: ObjectLockLegalHoldStatus
x-amz-expected-bucket-owner: ExpectedBucketOwner

Body

URL 参数

名称 类型 是否必须 示例 说明

请求结构

文件二进制内容

响应语法

HTTP/1.1 200

x-amz-expiration: Expiration
ETag: ETag
x-amz-checksum-crc32: ChecksumCRC32
x-amz-checksum-crc32c: ChecksumCRC32C
x-amz-checksum-sha1: ChecksumSHA1
x-amz-checksum-sha256: ChecksumSHA256
x-amz-server-side-encryption: ServerSideEncryption
x-amz-version-id: VersionId
x-amz-server-side-encryption-customer-algorithm: SSECustomerAlgorithm
x-amz-server-side-encryption-customer-key-MD5: SSECustomerKeyMD5
x-amz-server-side-encryption-aws-kms-key-id: SSEKMSKeyId
x-amz-server-side-encryption-context: SSEKMSEncryptionContext
x-amz-server-side-encryption-bucket-key-enabled: BucketKeyEnabled
x-amz-request-charged: RequestCharged

响应参数

名称 类型 示例 说明

请求示例

通过 rclone 进行测试

测试指令

echo "hello world" | ./rclone \
	--dump bodies \
	--s3-force-path-style=false \
	rcat \
	minio:uptime/from/local/hello.txt

请求响应

2023/06/21 15:09:12 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2023/06/21 15:09:12 DEBUG : HTTP REQUEST (req 0x140001ca200)
2023/06/21 15:09:12 DEBUG : PUT /from/local/hello.txt HTTP/1.1
Host: uptime.minio.dev.173ops.com
User-Agent: rclone/v1.62.2
Content-Length: 12
Authorization: XXXX
Content-Md5: b1kCrCNwJL3QwXbLkwY9xA==
Content-Type: text/plain; charset=utf-8
X-Amz-Acl: default
X-Amz-Content-Sha256: UNSIGNED-PAYLOAD
X-Amz-Date: 20230621T070912Z
X-Amz-Meta-Mtime: 1687331352.229462
Accept-Encoding: gzip

hello world
2023/06/21 15:09:12 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2023/06/21 15:09:12 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2023/06/21 15:09:12 DEBUG : HTTP RESPONSE (req 0x140001ca200)
2023/06/21 15:09:12 DEBUG : HTTP/1.1 200 OK
Content-Length: 0
Accept-Ranges: bytes
Connection: keep-alive
Content-Security-Policy: block-all-mixed-content
Date: Wed, 21 Jun 2023 07:09:12 GMT
Etag: "6f5902ac237024bdd0c176cb93063dc4"
Server: nginx/1.16.1
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
X-Amz-Request-Id: 176A9AECCE4AA1C8
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

2023/06/21 15:09:12 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<



最后修改 2023.07.06: refactor: update some (5fe4b38)