首页 > 代码库 > SAIO - curl sample
SAIO - curl sample
-v 可以替换 -i。
============================================================================================================================================curl -v -H ‘X-Storage-User: test:tester‘ -H ‘X-Storage-Pass: testing‘ http://127.0.0.1:8080/auth/v1.0* Hostname was NOT found in DNS cache* Trying 127.0.0.1...* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)> GET /auth/v1.0 HTTP/1.1> User-Agent: curl/7.35.0> Host: 127.0.0.1:8080> Accept: */*> X-Storage-User: test:tester> X-Storage-Pass: testing> < HTTP/1.1 200 OK< X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_test< X-Auth-Token-Expires: 82906< X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df< Content-Type: text/html; charset=UTF-8< X-Storage-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df< Content-Length: 0< X-Trans-Id: txd4d32beb4d3b471aace97-0058fee16a< X-Openstack-Request-Id: txd4d32beb4d3b471aace97-0058fee16a< Date: Tue, 25 Apr 2017 05:40:58 GMT< * Connection #0 to host 127.0.0.1 left intact============================================================================================================================================GET /info List activated capabilities--------------------------------------------------------------------------------------------------------------------------------------------No ideal============================================================================================================================================GET /v1/{account} Show account details and list containers--------------------------------------------------------------------------------------------------------------------------------------------curl -i http://127.0.0.1:8080/v1/AUTH_test?format=json -X GET -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKX-Account-Storage-Policy-Gold-Bytes-Used: 105915Content-Length: 184X-Account-Storage-Policy-Gold-Object-Count: 1X-Account-Object-Count: 1X-Timestamp: 1492757716.05585X-Account-Storage-Policy-Gold-Container-Count: 2X-Account-Bytes-Used: 105915X-Account-Container-Count: 2Content-Type: application/json; charset=utf-8Accept-Ranges: bytesX-Trans-Id: tx91a9aec393834e7b93753-0058fed875X-Openstack-Request-Id: tx91a9aec393834e7b93753-0058fed875Date: Tue, 25 Apr 2017 05:02:45 GMT[{"count": 1, "last_modified": "2017-04-21T08:55:53.410310", "bytes": 105915, "name": "images" }, { "count": 0, "last_modified": "2017-04-25T04:56:57.477190", "bytes": 0, "name": "xxx" }]============================================================================================================================================POST /v1/{account} Create, update, or delete account metadata--------------------------------------------------------------------------------------------------------------------------------------------Create account metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test -X POST -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘ -H "X-Account-Meta-Book: MobyDick" -H "X-Account-Meta-Subject: Literature"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx0fe4a2086bbc465192d85-0058fed9f4X-Openstack-Request-Id: tx0fe4a2086bbc465192d85-0058fed9f4Date: Tue, 25 Apr 2017 05:09:08 GMT- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - curl -i http://127.0.0.1:8080/v1/AUTH_test?format=json -X GET -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKX-Account-Storage-Policy-Gold-Bytes-Used: 105915Content-Length: 184X-Account-Storage-Policy-Gold-Object-Count: 1X-Account-Object-Count: 1X-Account-Meta-Book: MobyDickX-Timestamp: 1492757716.05145X-Account-Storage-Policy-Gold-Container-Count: 2X-Account-Meta-Subject: LiteratureX-Account-Bytes-Used: 105915X-Account-Container-Count: 2Content-Type: application/json; charset=utf-8Accept-Ranges: bytesX-Trans-Id: tx01f6a96a0b6e4a8780f38-0058feda2bX-Openstack-Request-Id: tx01f6a96a0b6e4a8780f38-0058feda2bDate: Tue, 25 Apr 2017 05:10:03 GMT[{"count": 1, "last_modified": "2017-04-21T08:55:53.410310", "bytes": 105915, "name": "images"}, {"count": 0, "last_modified": "2017-04-25T04:56:57.477190", "bytes": 0, "name": "xxx"}]--------------------------------------------------------------------------------------------------------------------------------------------Update account metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test -X POST -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘ -H "X-Account-Meta-Subject: AmericanLiterature"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx4819508652064d62bf15f-0058fedb19X-Openstack-Request-Id: tx4819508652064d62bf15f-0058fedb19Date: Tue, 25 Apr 2017 05:14:01 GMT- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - curl -i http://127.0.0.1:8080/v1/AUTH_test?format=json -X GET -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKX-Account-Storage-Policy-Gold-Bytes-Used: 105915Content-Length: 184X-Account-Storage-Policy-Gold-Object-Count: 1X-Account-Object-Count: 1X-Account-Meta-Book: MobyDickX-Timestamp: 1492757716.06009X-Account-Storage-Policy-Gold-Container-Count: 2X-Account-Meta-Subject: AmericanLiteratureX-Account-Bytes-Used: 105915X-Account-Container-Count: 2Content-Type: application/json; charset=utf-8Accept-Ranges: bytesX-Trans-Id: tx94b01c7f7a0e45d7a1e59-0058fedb41X-Openstack-Request-Id: tx94b01c7f7a0e45d7a1e59-0058fedb41Date: Tue, 25 Apr 2017 05:14:41 GMT[{"count": 1, "last_modified": "2017-04-21T08:55:53.410310", "bytes": 105915, "name": "images"}, {"count": 0, "last_modified": "2017-04-25T04:56:57.477190", "bytes": 0, "name": "xxx"}]--------------------------------------------------------------------------------------------------------------------------------------------Delete account metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test -X POST -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘ -H "X-Remove-Account-Meta-Subject: x"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx82f5194a860243fabd07f-0058fedb9dX-Openstack-Request-Id: tx82f5194a860243fabd07f-0058fedb9dDate: Tue, 25 Apr 2017 05:16:13 GMT- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - curl -i http://127.0.0.1:8080/v1/AUTH_test?format=json -X GET -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKX-Account-Storage-Policy-Gold-Bytes-Used: 105915Content-Length: 184X-Account-Storage-Policy-Gold-Object-Count: 1X-Account-Object-Count: 1X-Account-Meta-Book: MobyDickX-Timestamp: 1492757716.05145X-Account-Storage-Policy-Gold-Container-Count: 2X-Account-Bytes-Used: 105915X-Account-Container-Count: 2Content-Type: application/json; charset=utf-8Accept-Ranges: bytesX-Trans-Id: txe034bd7017bc4a59b64ec-0058fedbc6X-Openstack-Request-Id: txe034bd7017bc4a59b64ec-0058fedbc6Date: Tue, 25 Apr 2017 05:16:54 GMT[{"count": 1, "last_modified": "2017-04-21T08:55:53.410310", "bytes": 105915, "name": "images"}, {"count": 0, "last_modified": "2017-04-25T04:56:57.477190", "bytes": 0, "name": "xxx"}]============================================================================================================================================HEAD /v1/{account} Show account metadata--------------------------------------------------------------------------------------------------------------------------------------------curl -i http://127.0.0.1:8080/v1/AUTH_test -X HEAD -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 204 No ContentX-Account-Storage-Policy-Gold-Bytes-Used: 105915Content-Length: 0X-Account-Storage-Policy-Gold-Object-Count: 1X-Account-Object-Count: 1X-Account-Meta-Book: MobyDickX-Timestamp: 1492757716.06009X-Account-Storage-Policy-Gold-Container-Count: 2X-Account-Bytes-Used: 105915X-Account-Container-Count: 2Content-Type: text/plain; charset=utf-8Accept-Ranges: bytesX-Trans-Id: tx9d257bd40a7942b59569b-0058fedc61X-Openstack-Request-Id: tx9d257bd40a7942b59569b-0058fedc61Date: Tue, 25 Apr 2017 05:19:29 GMT============================================================================================================================================GET /v1/{account}/{container} Show container details and list objects--------------------------------------------------------------------------------------------------------------------------------------------curl -i http://127.0.0.1:8080/v1/AUTH_test/images?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 187X-Container-Object-Count: 1Accept-Ranges: bytesX-Storage-Policy: goldLast-Modified: Fri, 21 Apr 2017 08:55:54 GMTX-Container-Bytes-Used: 105915X-Timestamp: 1492757716.07462Content-Type: application/json; charset=utf-8X-Trans-Id: txfe2e995f171a4dd68a27e-0058fede05X-Openstack-Request-Id: txfe2e995f171a4dd68a27e-0058fede05Date: Tue, 25 Apr 2017 05:26:29 GMT[{"hash": "d85ece7ab7e1e754f735445680c105a3", "last_modified": "2017-04-21T08:55:53.457130", "bytes": 105915, "name": "tumblr_loox9jiurg1qfheato1_500.jpeg", "content_type": "image/jpeg"}]============================================================================================================================================PUT /v1/{account}/{container} Create container--------------------------------------------------------------------------------------------------------------------------------------------Create a container with no metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test/steven -X PUT -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 201 CreatedContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx40cdfb41107648f085798-0058fedf12X-Openstack-Request-Id: tx40cdfb41107648f085798-0058fedf12Date: Tue, 25 Apr 2017 05:30:58 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/steven?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 2X-Container-Object-Count: 0Accept-Ranges: bytesX-Storage-Policy: goldLast-Modified: Tue, 25 Apr 2017 05:30:59 GMTX-Container-Bytes-Used: 0X-Timestamp: 1493098258.21036Content-Type: application/json; charset=utf-8X-Trans-Id: txdb2259bff2754dc1a3ab5-0058fedf45X-Openstack-Request-Id: txdb2259bff2754dc1a3ab5-0058fedf45Date: Tue, 25 Apr 2017 05:31:49 GMT[]- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create a container with metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain1 -X PUT -H "X-Auth-Token: $token" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘ -H "X-Container-Meta-Book: TomSawyer"HTTP/1.1 201 CreatedContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx72bc64ab735841899a15a-0058fee009X-Openstack-Request-Id: tx72bc64ab735841899a15a-0058fee009Date: Tue, 25 Apr 2017 05:35:05 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain1?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 2X-Container-Object-Count: 0Accept-Ranges: bytesX-Container-Meta-Book: TomSawyerX-Storage-Policy: goldLast-Modified: Tue, 25 Apr 2017 05:35:06 GMTX-Container-Bytes-Used: 0X-Timestamp: 1493098505.97541Content-Type: application/json; charset=utf-8X-Trans-Id: tx97d3cb162d51491cb37d6-0058fee025X-Openstack-Request-Id: tx97d3cb162d51491cb37d6-0058fee025Date: Tue, 25 Apr 2017 05:35:34 GMT[]- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create a container with an ACL to allow anybody to get an object in the marktwain2 container:curl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain2 -X PUT -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "X-Container-Read: .r:*"HTTP/1.1 201 CreatedContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: txd52b412593e241859edd5-0058fee0c8X-Openstack-Request-Id: txd52b412593e241859edd5-0058fee0c8Date: Tue, 25 Apr 2017 05:38:16 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain2?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 2X-Container-Object-Count: 0Accept-Ranges: bytesX-Storage-Policy: goldLast-Modified: Tue, 25 Apr 2017 05:38:17 GMTX-Container-Read: .r:*X-Container-Bytes-Used: 0X-Timestamp: 1493098696.61888Content-Type: application/json; charset=utf-8X-Trans-Id: txbf62acf788384fe59c096-0058fee0fdX-Openstack-Request-Id: txbf62acf788384fe59c096-0058fee0fdDate: Tue, 25 Apr 2017 05:39:09 GMT[]============================================================================================================================================POST /v1/{account}/{container} Create, update, or delete container metadata--------------------------------------------------------------------------------------------------------------------------------------------Create container metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain -X POST -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "X-Container-Meta-Author: MarkTwain" -H "X-Container-Meta-Web-Directory-Type: text/directory" -H "X-Container-Meta-Century: Nineteenth"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx80486d55c56a405ea9d27-0058fee28fX-Openstack-Request-Id: tx80486d55c56a405ea9d27-0058fee28fDate: Tue, 25 Apr 2017 05:45:51 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 2X-Container-Object-Count: 0Accept-Ranges: bytesX-Container-Meta-Web-Directory-Type: text/directoryX-Storage-Policy: goldLast-Modified: Tue, 25 Apr 2017 05:45:52 GMTX-Container-Meta-Century: NineteenthX-Container-Meta-Author: MarkTwainX-Container-Bytes-Used: 0X-Timestamp: 1493098395.44006Content-Type: application/json; charset=utf-8X-Trans-Id: tx8e3430bbb97c4605ad3ed-0058fee2b4X-Openstack-Request-Id: tx8e3430bbb97c4605ad3ed-0058fee2b4Date: Tue, 25 Apr 2017 05:46:28 GMT[]- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Update container metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain -X POST -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "X-Container-Meta-Author: SamuelClemens"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: txd61df6e87a83485f8964e-0058fee305X-Openstack-Request-Id: txd61df6e87a83485f8964e-0058fee305Date: Tue, 25 Apr 2017 05:47:49 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 2X-Container-Object-Count: 0Accept-Ranges: bytesX-Container-Meta-Web-Directory-Type: text/directoryX-Storage-Policy: goldLast-Modified: Tue, 25 Apr 2017 05:47:50 GMTX-Container-Meta-Century: NineteenthX-Container-Meta-Author: SamuelClemensX-Container-Bytes-Used: 0X-Timestamp: 1493098395.44006Content-Type: application/json; charset=utf-8X-Trans-Id: tx09c966876ee44dcca2aca-0058fee318X-Openstack-Request-Id: tx09c966876ee44dcca2aca-0058fee318Date: Tue, 25 Apr 2017 05:48:08 GMT[]- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Delete container metadata:url -i http://127.0.0.1:8080/v1/AUTH_test/marktwain -X POST -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "X-Remove-Container-Meta-Century: x"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: txfb861262da3e46b2b6f91-0058fee34fX-Openstack-Request-Id: txfb861262da3e46b2b6f91-0058fee34fDate: Tue, 25 Apr 2017 05:49:03 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 2X-Container-Object-Count: 0Accept-Ranges: bytesX-Container-Meta-Web-Directory-Type: text/directoryX-Storage-Policy: goldLast-Modified: Tue, 25 Apr 2017 05:49:04 GMTX-Container-Meta-Author: SamuelClemensX-Container-Bytes-Used: 0X-Timestamp: 1493098395.43160Content-Type: application/json; charset=utf-8X-Trans-Id: tx564b7f2c2adc45f1b6c7c-0058fee372X-Openstack-Request-Id: tx564b7f2c2adc45f1b6c7c-0058fee372Date: Tue, 25 Apr 2017 05:49:38 GMT[]============================================================================================================================================HEAD /v1/{account}/{container} Show container metadata--------------------------------------------------------------------------------------------------------------------------------------------curl -i http://127.0.0.1:8080/v1/AUTH_test/marktwain -X HEAD -H "X-Auth-Token: $AUTH_tk94d4de39e7704fcd956bb13ee27415df"401============================================================================================================================================DELETE /v1/{account}/{container} Delete container--------------------------------------------------------------------------------------------------------------------------------------------the container exists and the deletion succeeds:curl -i http://127.0.0.1:8080/v1/AUTH_test/steven -X DELETE -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: txf0918003c64d4078a4e9a-0058fee6e8X-Openstack-Request-Id: txf0918003c64d4078a4e9a-0058fee6e8Date: Tue, 25 Apr 2017 06:04:24 GMT- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - the container does not exist:curl -i http://127.0.0.1:8080/v1/AUTH_test/steven -X DELETE -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 404 Not FoundContent-Length: 70Content-Type: text/html; charset=UTF-8X-Trans-Id: tx24667c6afe4b48a8887a8-0058fee7afX-Openstack-Request-Id: tx24667c6afe4b48a8887a8-0058fee7afDate: Tue, 25 Apr 2017 06:07:43 GMT<html><h1>Not Found</h1><p>The resource could not be found.</p></html>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - the container exists but is not empty:curl -i http://127.0.0.1:8080/v1/AUTH_test/images -X DELETE -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 409 ConflictContent-Length: 95Content-Type: text/html; charset=UTF-8X-Trans-Id: txe85112607ddb41c38dd81-0058fee807X-Openstack-Request-Id: txe85112607ddb41c38dd81-0058fee807Date: Tue, 25 Apr 2017 06:09:11 GMT<html><h1>Conflict</h1><p>There was a conflict when trying to complete your request.</p></html>============================================================================================================================================GET /v1/{account}/{container}/{object} Get object content and metadata--------------------------------------------------------------------------------------------------------------------------------------------Show object details for the goodbye object in the images container:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X GET -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 200 OKContent-Length: 5Accept-Ranges: bytesLast-Modified: Tue, 25 Apr 2017 06:40:47 GMTEtag: 8b1a9953c4611296a827abf8c47804d7X-Timestamp: 1493102446.62947Content-Type: text/html; charset=UTF-8X-Trans-Id: tx5fbee375b002428099534-0058feefffX-Openstack-Request-Id: tx5fbee375b002428099534-0058feefffDate: Tue, 25 Apr 2017 06:43:11 GMTHello- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Show object details for the goodbye object, which does not exist, in the images container:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/goodbye -X GET -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 404 Not FoundContent-Length: 70Content-Type: text/html; charset=UTF-8X-Trans-Id: txac488c2c8b3240b597eff-0058fee93eX-Openstack-Request-Id: txac488c2c8b3240b597eff-0058fee93eDate: Tue, 25 Apr 2017 06:14:23 GMT<html><h1>Not Found</h1><p>The resource could not be found.</p></html>============================================================================================================================================PUT /v1/{account}/{container}/{object} Create or replace object--------------------------------------------------------------------------------------------------------------------------------------------Create object:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X PUT -d "Hello" -H "Content-Type: text/html; charset=UTF-8" -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 201 CreatedLast-Modified: Tue, 25 Apr 2017 06:40:47 GMTContent-Length: 0Etag: 8b1a9953c4611296a827abf8c47804d7Content-Type: text/html; charset=UTF-8X-Trans-Id: tx75a91f236485461c8b2c6-0058feef6eX-Openstack-Request-Id: tx75a91f236485461c8b2c6-0058feef6eDate: Tue, 25 Apr 2017 06:40:46 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/images?format=json -X GET -H "Content-Length: 0" -H ‘X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df‘HTTP/1.1 200 OKContent-Length: 361X-Container-Object-Count: 2Accept-Ranges: bytesX-Storage-Policy: goldLast-Modified: Fri, 21 Apr 2017 08:55:54 GMTX-Container-Bytes-Used: 105920X-Timestamp: 1492757716.07462Content-Type: application/json; charset=utf-8X-Trans-Id: txca728f657ab94cf2a4bda-0058feef9dX-Openstack-Request-Id: txca728f657ab94cf2a4bda-0058feef9dDate: Tue, 25 Apr 2017 06:41:33 GMT[{"hash": "8b1a9953c4611296a827abf8c47804d7", "last_modified": "2017-04-25T06:40:46.629470", "bytes": 5, "name": "helloworld.txt", "content_type": "text/html;charset=UTF-8"}, {"hash": "d85ece7ab7e1e754f735445680c105a3", "last_modified": "2017-04-21T08:55:53.457130", "bytes": 105915, "name": "tumblr_loox9jiurg1qfheato1_500.jpeg", "content_type": "image/jpeg"}]- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Replace object:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X PUT -d "Hola" -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 201 CreatedLast-Modified: Tue, 25 Apr 2017 06:45:29 GMTContent-Length: 0Etag: f688ae26e9cfa3ba6235477831d5122eContent-Type: text/html; charset=UTF-8X-Trans-Id: tx9215039f510f42edb0529-0058fef088X-Openstack-Request-Id: tx9215039f510f42edb0529-0058fef088Date: Tue, 25 Apr 2017 06:45:28 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X GET -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 200 OKContent-Length: 4Accept-Ranges: bytesLast-Modified: Tue, 25 Apr 2017 06:45:29 GMTEtag: f688ae26e9cfa3ba6235477831d5122eX-Timestamp: 1493102728.78486Content-Type: application/x-www-form-urlencodedX-Trans-Id: tx3a99e48a76094a6087b85-0058fef0cfX-Openstack-Request-Id: tx3a99e48a76094a6087b85-0058fef0cfDate: Tue, 25 Apr 2017 06:46:39 GMTHola============================================================================================================================================COPY /v1/{account}/{container}/{object} Copy object--------------------------------------------------------------------------------------------------------------------------------------------Copy the helloworld.txt object from the images container to the janeausten container:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X COPY -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "Destination: janeausten/helloworld.txt"HTTP/1.1 201 CreatedLast-Modified: Tue, 25 Apr 2017 06:51:47 GMTContent-Length: 0Etag: f688ae26e9cfa3ba6235477831d5122eContent-Type: text/html; charset=UTF-8X-Copied-From-Account: AUTH_testX-Copied-From-Last-Modified: Tue, 25 Apr 2017 06:45:29 GMTX-Copied-From: images/helloworld.txtX-Trans-Id: txa157741e2ca7423494f3c-0058fef202X-Openstack-Request-Id: txa157741e2ca7423494f3c-0058fef202Date: Tue, 25 Apr 2017 06:51:47 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/janeausten/helloworld.txt -X GET -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 200 OKContent-Length: 4Accept-Ranges: bytesLast-Modified: Tue, 25 Apr 2017 06:51:47 GMTEtag: f688ae26e9cfa3ba6235477831d5122eX-Timestamp: 1493103106.98913Content-Type: application/x-www-form-urlencodedX-Trans-Id: txb046159e3e24487fb2172-0058fef241X-Openstack-Request-Id: txb046159e3e24487fb2172-0058fef241Date: Tue, 25 Apr 2017 06:52:49 GMTHola- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Alternatively, you can use PUT to copy the goodbye object from the marktwain container to the janeausten container. This request requires a Content-Length header, even if it is set to zero (0).curl -i $publicURL/janeausten/helloworld.txt -X PUT -H "X-Auth-Token: $token" -H "X-Copy-From: /images/helloworld.txt" -H "Content-Length: 0"============================================================================================================================================DELETE /v1/{account}/{container}/{object} Delete object--------------------------------------------------------------------------------------------------------------------------------------------curl -i http://127.0.0.1:8080/v1/AUTH_test/janeausten/helloworld.txt -X DELETE -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 204 No ContentContent-Length: 0Content-Type: text/html; charset=UTF-8X-Trans-Id: tx340898f7a6bb4b4f8a965-0058fef37cX-Openstack-Request-Id: tx340898f7a6bb4b4f8a965-0058fef37cDate: Tue, 25 Apr 2017 06:58:04 GMTcurl -i http://127.0.0.1:8080/v1/AUTH_test/janeausten/helloworld.txt -X GET -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 404 Not FoundContent-Length: 70Content-Type: text/html; charset=UTF-8X-Trans-Id: tx6aff1330e11a4cda9ac46-0058fef39fX-Openstack-Request-Id: tx6aff1330e11a4cda9ac46-0058fef39fDate: Tue, 25 Apr 2017 06:58:39 GMT<html><h1>Not Found</h1><p>The resource could not be found.</p></html>============================================================================================================================================HEAD /v1/{account}/{container}/{object} Show object metadata--------------------------------------------------------------------------------------------------------------------------------------------curl http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt --head -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 200 OKContent-Length: 4Accept-Ranges: bytesLast-Modified: Tue, 25 Apr 2017 06:45:29 GMTEtag: f688ae26e9cfa3ba6235477831d5122eX-Timestamp: 1493102728.78486Content-Type: application/x-www-form-urlencodedX-Trans-Id: txd04f6d12851e42db9d27c-0058fef416X-Openstack-Request-Id: txd04f6d12851e42db9d27c-0058fef416Date: Tue, 25 Apr 2017 07:00:38 GMT============================================================================================================================================POST /v1/{account}/{container}/{object} Create or update object metadata--------------------------------------------------------------------------------------------------------------------------------------------Create object metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X POST -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "X-Object-Meta-Book: GoodbyeColumbus"HTTP/1.1 202 AcceptedContent-Length: 76Content-Type: text/html; charset=UTF-8X-Trans-Id: tx619621d6436e4edb9745b-0058fef491X-Openstack-Request-Id: tx619621d6436e4edb9745b-0058fef491Date: Tue, 25 Apr 2017 07:02:41 GMT<html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>curl http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt --head -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 200 OKContent-Length: 4Accept-Ranges: bytesLast-Modified: Tue, 25 Apr 2017 07:02:42 GMTEtag: f688ae26e9cfa3ba6235477831d5122eX-Timestamp: 1493103761.44419X-Object-Meta-Book: GoodbyeColumbusContent-Type: application/x-www-form-urlencodedX-Trans-Id: txce5f22ffdaff4c8aa189d-0058fef4b0X-Openstack-Request-Id: txce5f22ffdaff4c8aa189d-0058fef4b0Date: Tue, 25 Apr 2017 07:03:12 GMT- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Update object metadata:curl -i http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt -X POST -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df" -H "X-Object-Meta-Book: GoodbyeOldFriend"HTTP/1.1 202 AcceptedContent-Length: 76Content-Type: text/html; charset=UTF-8X-Trans-Id: tx860aef854e634d9290351-0058fef4e6X-Openstack-Request-Id: tx860aef854e634d9290351-0058fef4e6Date: Tue, 25 Apr 2017 07:04:06 GMT<html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>curl http://127.0.0.1:8080/v1/AUTH_test/images/helloworld.txt --head -H "X-Auth-Token: AUTH_tk94d4de39e7704fcd956bb13ee27415df"HTTP/1.1 200 OKContent-Length: 4Accept-Ranges: bytesLast-Modified: Tue, 25 Apr 2017 07:04:07 GMTEtag: f688ae26e9cfa3ba6235477831d5122eX-Timestamp: 1493103846.44231X-Object-Meta-Book: GoodbyeOldFriendContent-Type: application/x-www-form-urlencodedX-Trans-Id: txb8013a1c8ae7478482080-0058fef4f8X-Openstack-Request-Id: txb8013a1c8ae7478482080-0058fef4f8Date: Tue, 25 Apr 2017 07:04:24 GMT============================================================================================================================================GET /v1/endpoints List endpoints--------------------------------------------------------------------------------------------------------------------------------------------No ideal============================================================================================================================================
SAIO - curl sample
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。