CDN加速

PostObject

更新时间:2021-06-17 14:14:48

PostObject

使用表单的方式上传数据,适用于Html Form,需要IAM wos:PostObject权限

请求语法

POST / HTTP/1.1
Host: Bucket.Endpoint
Keep-Alive: 300
Connection: keep-alive
Content-Type: multipart/form-data; boundary=-9431149156168
Content-Length: length

--9431149156168
Content-Disposition: form-data; name=”key”
key
--9431149156168
Content-Disposition: form-data; name=”content-Type”
content_type
--9431149156168
Content-Disposition: form-data; name=”x-wos-meta-*”
x-wos-meta-*
--9431149156168
Content-Disposition: form-data; name=”content-MD5”
content_MD5
--9431149156168
Content-Disposition: form-data; name=”policy”
policy=
--9431149156168
Content-Disposition: form-data; name=”signature”
signature=
--9431149156168
Content-Disposition: form-data; name=”file”; filename=”MyFilename”
Content-Type: image/jpeg
fil_content
--9431149156168
Content-Disposition: form-data; name=”submit”
Upload to WCS
--9431149156168—

URI请求参数

请求头部

仅使用公共请求头部

表单参数

参数名称

描述

是否必须

key

通过此请求创建的对象名称

file

上传的对象的内容。
类型:二进制或文本类型。
约束条件:一个请求中只能包含有一个file参数

content-type

MIME类型,表示上传对象内容的格式。

content-MD5

base64编码的128MD5摘要信息。加入Content-MD5参数,WCS收到上传的对象后,会对对象进行MD5校验,如果不一致则返回出错信息

x-wos-storage-class定文件的存储类型,Standard-标准存储、IA-低频存储、Archive-归档存储。默认同空间的存储类型
x-wos-meta-*客户自定义元数据,会在headObject、getObject时的头部原样返回

请求主体

Object Body

响应语法

HTTP/1.1 status_code
x-wos-request-id: request id
Content-Type: type
Location: location
Date: date
ETag: etag
Server:WS-web-server

响应头部

除使用公共头部外,还包含

元素名称

描述

Etag上传数据的Entity tag

响应元素

示例

POST /object HTTP/1.1
Date: Fri, 18 May 2017 01:19:49 GMT
Host: bucket.s3-cn-east-1.wcsapi.com
Content-Type: multipart/form-data; boundary=---------------------------7db143f50da2
Content-Length: 2424
Content-Disposition: form-data; name="AWSAccessKeyId"
94963ba9c9ebb26620acf4d8aac40b72c5706c6a
-----------------------------7db143f50da2
Content-Disposition: form-data; name="key"
object01
-----------------------------7db143f50da2
Content-Disposition: form-data; name="acl"
public-read
-----------------------------7db143f50da2
Content-Disposition: form-data; name="content-type"
text/plain
-----------------------------7db143f50da2
Content-Disposition: form-data; name="policy"
eyJjb25kaXRpb25zIjogW3siYWNsIjogInB1YmxpYy1yZWFkIn0sIHsiYnVja2V0IjogIndzdGVzdC0yIn0sIHsia2V5IjogInYydDEudHh0In0sIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAxMDQ4NTc5LCAxMDQ4NTc2MF1dLCAiZXhwaXJhdGlvbiI6ICIyMDE3LTEyLTEzVDA3OjU0OjU5LjEzWiJ9
-----------------------------7db143f50da2
Content-Disposition: form-data; name="signature"
+c+e164E4cZ7J1WEVp/BKEI91bs=
-----------------------------7db143f50da2
Content-Disposition: form-data; name="file"; filename="C:\Testtools\UpLoadFiles\object
\1024Bytes.txt"
Content-Type: text/plain
01234567890
-----------------------------7db143f50da2

HTTP/1 100 Continue
HTTP/1 200 OK
x-wos-request-id: 90E2BA00C26C00000133B442A90063FD
Date: Fri, 18 May 2017 01:20:27 GMT
ETag: "ab7abb0da4bca5323ab6119bb5dcd296"
Content-Length: 0
Connection: close
Server: WS-Web-Server