• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Objects
  5. POST Object
  6. Examples

Examples

Sample Request

POST / HTTP/1.1 
 Date: Fri, 18 Nov 2011 01:19:49 GMT 
 Host: bucketname.obs.example.com
 Content-Type: multipart/form-data; boundary=---------------------------7db143f50da2 
 Content-Length: 2424 


 -----------------------------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="expires" 
 1000 
 -----------------------------7db143f50da2 
 Content-Disposition: form-data; name="AWSAccessKeyId" 
 14RZT432N80TGDF2Y2G2 
 -----------------------------7db143f50da2 
 Content-Disposition: form-data; name="policy" 
 ewogICJleHBpcmF0aW9uIjogIjIwMTItMDEtMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImJ1Y2tldCI6ICJ0Yy5wb3N0LmV4cGlyZXMuMDAxIiB9LAogICAgeyJhY2wiOiAicHVibGljLXJlYWQiIH0sCiAgICB7IkV4cGlyZXMiOiAiMTAwMCIgfSwKICAgIFsiZXEiLCAiJGtleSIsICJvYmplY3QwMSJdLAogICAgWyJzdGFydHMtd2l0aCIsICIkQ29udGVudC1UeXBlIiwgInRleHQvIl0sCiAgXQp9Cg== 
 -----------------------------7db143f50da2 
 Content-Disposition: form-data; name="signature" 
 Vk6rwO0Nq09BLhvNSIYwSJTRQ+k= 
 -----------------------------7db143f50da2 
 Content-Disposition: form-data; name="file"; filename="C:\Testtools\UpLoadFiles\object\1024Bytes.txt" 
 Content-Type: text/plain 
 01234567890 
 -----------------------------7db143f50da2 
 Content-Disposition: form-data; name="submit" 
 Upload 
 -----------------------------7db143f50da2--

Sample Response for Uploading Objects to a Bucket with No Versioning Configured

HTTP/1.1 204 No Content 
 Server: OBS 
 x-amz-request-id: 90E2BA00C26C00000133B442A90063FD 
 x-amz-id-2: OTBFMkJBMDBDMjZDMDAwMDAxMzNCNDQyQTkwMDYzRkRBQUFBQUFBQWJiYmJiYmJi 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 Content-Type: text/xml 
 Location: http://obs.example.com/tc.post.expires.001/object01
 Date: Fri, 18 Nov 2011 01:20:27 GMT 
 ETag: "ab7abb0da4bca5323ab6119bb5dcd296"

Sample Response for Uploading Objects to a Bucket with Versioning Enabled

HTTP/1.1 204 No Content 
 Server: OBS 
 x-amz-request-id: DCD2FC9CAB780000014394C8D18D7A7F 
 x-amz-id-2: ebDwZjh64WVojaUVqPaWaXPqqfqLcp15DNr1KkAkP9EXyWrLsrqQoUs1Xn49VC9h 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 Content-Type: text/xml 
 Location: http://192.168.69.11/example/testfile.txt 
 ETag: "098f6bcd4621d373cade4e832627b4f6" 
 x-amz-version-id: AAABQ5TI0anc0vycq3gAAAAyVURTRkha 
 Date: Wed, 15 Jan 2014 07:23:45 GMT

Sample Response for Uploading Objects to a Bucket with Versioning Suspended

HTTP/1.1 204 No Content 
 Server: OBS 
 x-amz-request-id: DCD2FC9CAB780000014394F041CA8F94 
 x-amz-id-2: 8EUVTpv5QBvTslQVlaDrzEauRpDP9fusd4IiJrgjExdPlyz+xleFMCNZD/zK0aZg 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 Content-Type: text/xml 
 Location: http://192.168.69.11/example/testfile.txt 
 ETag: "cc03e747a6afbbcbf8be7668acfebee5" 
 x-amz-version-id: null 
 Date: Wed, 15 Jan 2014 08:06:50 GMT