码迷,mamicode.com
首页 > Web开发 > 详细

SAIO - curl sample

时间:2017-05-11 09:20:10      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:==   pos   abi   show   cti   open   roc   www   div   

-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 OK
X-Account-Storage-Policy-Gold-Bytes-Used: 105915
Content-Length: 184
X-Account-Storage-Policy-Gold-Object-Count: 1
X-Account-Object-Count: 1
X-Timestamp: 1492757716.05585
X-Account-Storage-Policy-Gold-Container-Count: 2
X-Account-Bytes-Used: 105915
X-Account-Container-Count: 2
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
X-Trans-Id: tx91a9aec393834e7b93753-0058fed875
X-Openstack-Request-Id: tx91a9aec393834e7b93753-0058fed875
Date: 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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx0fe4a2086bbc465192d85-0058fed9f4
X-Openstack-Request-Id: tx0fe4a2086bbc465192d85-0058fed9f4
Date: 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 OK
X-Account-Storage-Policy-Gold-Bytes-Used: 105915
Content-Length: 184
X-Account-Storage-Policy-Gold-Object-Count: 1
X-Account-Object-Count: 1
X-Account-Meta-Book: MobyDick
X-Timestamp: 1492757716.05145
X-Account-Storage-Policy-Gold-Container-Count: 2
X-Account-Meta-Subject: Literature
X-Account-Bytes-Used: 105915
X-Account-Container-Count: 2
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
X-Trans-Id: tx01f6a96a0b6e4a8780f38-0058feda2b
X-Openstack-Request-Id: tx01f6a96a0b6e4a8780f38-0058feda2b
Date: 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 Content

Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx4819508652064d62bf15f-0058fedb19
X-Openstack-Request-Id: tx4819508652064d62bf15f-0058fedb19
Date: 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 OK
X-Account-Storage-Policy-Gold-Bytes-Used: 105915
Content-Length: 184
X-Account-Storage-Policy-Gold-Object-Count: 1
X-Account-Object-Count: 1
X-Account-Meta-Book: MobyDick
X-Timestamp: 1492757716.06009
X-Account-Storage-Policy-Gold-Container-Count: 2
X-Account-Meta-Subject: AmericanLiterature
X-Account-Bytes-Used: 105915
X-Account-Container-Count: 2
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
X-Trans-Id: tx94b01c7f7a0e45d7a1e59-0058fedb41
X-Openstack-Request-Id: tx94b01c7f7a0e45d7a1e59-0058fedb41
Date: 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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx82f5194a860243fabd07f-0058fedb9d
X-Openstack-Request-Id: tx82f5194a860243fabd07f-0058fedb9d
Date: 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 OK
X-Account-Storage-Policy-Gold-Bytes-Used: 105915
Content-Length: 184
X-Account-Storage-Policy-Gold-Object-Count: 1
X-Account-Object-Count: 1
X-Account-Meta-Book: MobyDick
X-Timestamp: 1492757716.05145
X-Account-Storage-Policy-Gold-Container-Count: 2
X-Account-Bytes-Used: 105915
X-Account-Container-Count: 2
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
X-Trans-Id: txe034bd7017bc4a59b64ec-0058fedbc6
X-Openstack-Request-Id: txe034bd7017bc4a59b64ec-0058fedbc6
Date: 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 Content
X-Account-Storage-Policy-Gold-Bytes-Used: 105915
Content-Length: 0
X-Account-Storage-Policy-Gold-Object-Count: 1
X-Account-Object-Count: 1
X-Account-Meta-Book: MobyDick
X-Timestamp: 1492757716.06009
X-Account-Storage-Policy-Gold-Container-Count: 2
X-Account-Bytes-Used: 105915
X-Account-Container-Count: 2
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
X-Trans-Id: tx9d257bd40a7942b59569b-0058fedc61
X-Openstack-Request-Id: tx9d257bd40a7942b59569b-0058fedc61
Date: 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 OK
Content-Length: 187
X-Container-Object-Count: 1
Accept-Ranges: bytes
X-Storage-Policy: gold
Last-Modified: Fri, 21 Apr 2017 08:55:54 GMT
X-Container-Bytes-Used: 105915
X-Timestamp: 1492757716.07462
Content-Type: application/json; charset=utf-8
X-Trans-Id: txfe2e995f171a4dd68a27e-0058fede05
X-Openstack-Request-Id: txfe2e995f171a4dd68a27e-0058fede05
Date: 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 Created
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx40cdfb41107648f085798-0058fedf12
X-Openstack-Request-Id: tx40cdfb41107648f085798-0058fedf12
Date: Tue, 25 Apr 2017 05:30:58 GMT

curl -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 OK
Content-Length: 2
X-Container-Object-Count: 0
Accept-Ranges: bytes
X-Storage-Policy: gold
Last-Modified: Tue, 25 Apr 2017 05:30:59 GMT
X-Container-Bytes-Used: 0
X-Timestamp: 1493098258.21036
Content-Type: application/json; charset=utf-8
X-Trans-Id: txdb2259bff2754dc1a3ab5-0058fedf45
X-Openstack-Request-Id: txdb2259bff2754dc1a3ab5-0058fedf45
Date: 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 Created
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx72bc64ab735841899a15a-0058fee009
X-Openstack-Request-Id: tx72bc64ab735841899a15a-0058fee009
Date: Tue, 25 Apr 2017 05:35:05 GMT

curl -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 OK
Content-Length: 2
X-Container-Object-Count: 0
Accept-Ranges: bytes
X-Container-Meta-Book: TomSawyer
X-Storage-Policy: gold
Last-Modified: Tue, 25 Apr 2017 05:35:06 GMT
X-Container-Bytes-Used: 0
X-Timestamp: 1493098505.97541
Content-Type: application/json; charset=utf-8
X-Trans-Id: tx97d3cb162d51491cb37d6-0058fee025
X-Openstack-Request-Id: tx97d3cb162d51491cb37d6-0058fee025
Date: 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 Created
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txd52b412593e241859edd5-0058fee0c8
X-Openstack-Request-Id: txd52b412593e241859edd5-0058fee0c8
Date: Tue, 25 Apr 2017 05:38:16 GMT

curl -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 OK
Content-Length: 2
X-Container-Object-Count: 0
Accept-Ranges: bytes
X-Storage-Policy: gold
Last-Modified: Tue, 25 Apr 2017 05:38:17 GMT
X-Container-Read: .r:*
X-Container-Bytes-Used: 0
X-Timestamp: 1493098696.61888
Content-Type: application/json; charset=utf-8
X-Trans-Id: txbf62acf788384fe59c096-0058fee0fd
X-Openstack-Request-Id: txbf62acf788384fe59c096-0058fee0fd
Date: 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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx80486d55c56a405ea9d27-0058fee28f
X-Openstack-Request-Id: tx80486d55c56a405ea9d27-0058fee28f
Date: Tue, 25 Apr 2017 05:45:51 GMT

curl -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 OK
Content-Length: 2
X-Container-Object-Count: 0
Accept-Ranges: bytes
X-Container-Meta-Web-Directory-Type: text/directory
X-Storage-Policy: gold
Last-Modified: Tue, 25 Apr 2017 05:45:52 GMT
X-Container-Meta-Century: Nineteenth
X-Container-Meta-Author: MarkTwain
X-Container-Bytes-Used: 0
X-Timestamp: 1493098395.44006
Content-Type: application/json; charset=utf-8
X-Trans-Id: tx8e3430bbb97c4605ad3ed-0058fee2b4
X-Openstack-Request-Id: tx8e3430bbb97c4605ad3ed-0058fee2b4
Date: 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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txd61df6e87a83485f8964e-0058fee305
X-Openstack-Request-Id: txd61df6e87a83485f8964e-0058fee305
Date: Tue, 25 Apr 2017 05:47:49 GMT

curl -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 OK
Content-Length: 2
X-Container-Object-Count: 0
Accept-Ranges: bytes
X-Container-Meta-Web-Directory-Type: text/directory
X-Storage-Policy: gold
Last-Modified: Tue, 25 Apr 2017 05:47:50 GMT
X-Container-Meta-Century: Nineteenth
X-Container-Meta-Author: SamuelClemens
X-Container-Bytes-Used: 0
X-Timestamp: 1493098395.44006
Content-Type: application/json; charset=utf-8
X-Trans-Id: tx09c966876ee44dcca2aca-0058fee318
X-Openstack-Request-Id: tx09c966876ee44dcca2aca-0058fee318
Date: 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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txfb861262da3e46b2b6f91-0058fee34f
X-Openstack-Request-Id: txfb861262da3e46b2b6f91-0058fee34f
Date: Tue, 25 Apr 2017 05:49:03 GMT

curl -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 OK
Content-Length: 2
X-Container-Object-Count: 0
Accept-Ranges: bytes
X-Container-Meta-Web-Directory-Type: text/directory
X-Storage-Policy: gold
Last-Modified: Tue, 25 Apr 2017 05:49:04 GMT
X-Container-Meta-Author: SamuelClemens
X-Container-Bytes-Used: 0
X-Timestamp: 1493098395.43160
Content-Type: application/json; charset=utf-8
X-Trans-Id: tx564b7f2c2adc45f1b6c7c-0058fee372
X-Openstack-Request-Id: tx564b7f2c2adc45f1b6c7c-0058fee372
Date: 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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txf0918003c64d4078a4e9a-0058fee6e8
X-Openstack-Request-Id: txf0918003c64d4078a4e9a-0058fee6e8
Date: 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 Found
Content-Length: 70
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx24667c6afe4b48a8887a8-0058fee7af
X-Openstack-Request-Id: tx24667c6afe4b48a8887a8-0058fee7af
Date: 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 Conflict
Content-Length: 95
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txe85112607ddb41c38dd81-0058fee807
X-Openstack-Request-Id: txe85112607ddb41c38dd81-0058fee807
Date: 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 OK
Content-Length: 5
Accept-Ranges: bytes
Last-Modified: Tue, 25 Apr 2017 06:40:47 GMT
Etag: 8b1a9953c4611296a827abf8c47804d7
X-Timestamp: 1493102446.62947
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx5fbee375b002428099534-0058feefff
X-Openstack-Request-Id: tx5fbee375b002428099534-0058feefff
Date: Tue, 25 Apr 2017 06:43:11 GMT

Hello

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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 Found
Content-Length: 70
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txac488c2c8b3240b597eff-0058fee93e
X-Openstack-Request-Id: txac488c2c8b3240b597eff-0058fee93e
Date: 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 Created
Last-Modified: Tue, 25 Apr 2017 06:40:47 GMT
Content-Length: 0
Etag: 8b1a9953c4611296a827abf8c47804d7
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx75a91f236485461c8b2c6-0058feef6e
X-Openstack-Request-Id: tx75a91f236485461c8b2c6-0058feef6e
Date: Tue, 25 Apr 2017 06:40:46 GMT

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 OK

Content-Length: 361
X-Container-Object-Count: 2
Accept-Ranges: bytes
X-Storage-Policy: gold
Last-Modified: Fri, 21 Apr 2017 08:55:54 GMT
X-Container-Bytes-Used: 105920
X-Timestamp: 1492757716.07462
Content-Type: application/json; charset=utf-8
X-Trans-Id: txca728f657ab94cf2a4bda-0058feef9d
X-Openstack-Request-Id: txca728f657ab94cf2a4bda-0058feef9d
Date: 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 Created
Last-Modified: Tue, 25 Apr 2017 06:45:29 GMT
Content-Length: 0
Etag: f688ae26e9cfa3ba6235477831d5122e
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx9215039f510f42edb0529-0058fef088
X-Openstack-Request-Id: tx9215039f510f42edb0529-0058fef088
Date: Tue, 25 Apr 2017 06:45:28 GMT

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 OK
Content-Length: 4
Accept-Ranges: bytes
Last-Modified: Tue, 25 Apr 2017 06:45:29 GMT
Etag: f688ae26e9cfa3ba6235477831d5122e
X-Timestamp: 1493102728.78486
Content-Type: application/x-www-form-urlencoded
X-Trans-Id: tx3a99e48a76094a6087b85-0058fef0cf
X-Openstack-Request-Id: tx3a99e48a76094a6087b85-0058fef0cf
Date: Tue, 25 Apr 2017 06:46:39 GMT

Hola

============================================================================================================================================

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 Created
Last-Modified: Tue, 25 Apr 2017 06:51:47 GMT
Content-Length: 0
Etag: f688ae26e9cfa3ba6235477831d5122e
Content-Type: text/html; charset=UTF-8
X-Copied-From-Account: AUTH_test
X-Copied-From-Last-Modified: Tue, 25 Apr 2017 06:45:29 GMT
X-Copied-From: images/helloworld.txt
X-Trans-Id: txa157741e2ca7423494f3c-0058fef202
X-Openstack-Request-Id: txa157741e2ca7423494f3c-0058fef202
Date: Tue, 25 Apr 2017 06:51:47 GMT

curl -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 OK
Content-Length: 4
Accept-Ranges: bytes
Last-Modified: Tue, 25 Apr 2017 06:51:47 GMT
Etag: f688ae26e9cfa3ba6235477831d5122e
X-Timestamp: 1493103106.98913
Content-Type: application/x-www-form-urlencoded
X-Trans-Id: txb046159e3e24487fb2172-0058fef241
X-Openstack-Request-Id: txb046159e3e24487fb2172-0058fef241
Date: Tue, 25 Apr 2017 06:52:49 GMT

Hola

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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 Content
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx340898f7a6bb4b4f8a965-0058fef37c
X-Openstack-Request-Id: tx340898f7a6bb4b4f8a965-0058fef37c
Date: Tue, 25 Apr 2017 06:58:04 GMT

curl -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 Found
Content-Length: 70
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx6aff1330e11a4cda9ac46-0058fef39f
X-Openstack-Request-Id: tx6aff1330e11a4cda9ac46-0058fef39f
Date: 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 OK
Content-Length: 4
Accept-Ranges: bytes
Last-Modified: Tue, 25 Apr 2017 06:45:29 GMT
Etag: f688ae26e9cfa3ba6235477831d5122e
X-Timestamp: 1493102728.78486
Content-Type: application/x-www-form-urlencoded
X-Trans-Id: txd04f6d12851e42db9d27c-0058fef416
X-Openstack-Request-Id: txd04f6d12851e42db9d27c-0058fef416
Date: 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 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx619621d6436e4edb9745b-0058fef491
X-Openstack-Request-Id: tx619621d6436e4edb9745b-0058fef491
Date: 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 OK
Content-Length: 4
Accept-Ranges: bytes
Last-Modified: Tue, 25 Apr 2017 07:02:42 GMT
Etag: f688ae26e9cfa3ba6235477831d5122e
X-Timestamp: 1493103761.44419
X-Object-Meta-Book: GoodbyeColumbus
Content-Type: application/x-www-form-urlencoded
X-Trans-Id: txce5f22ffdaff4c8aa189d-0058fef4b0
X-Openstack-Request-Id: txce5f22ffdaff4c8aa189d-0058fef4b0
Date: 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 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx860aef854e634d9290351-0058fef4e6
X-Openstack-Request-Id: tx860aef854e634d9290351-0058fef4e6
Date: 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 OK
Content-Length: 4
Accept-Ranges: bytes
Last-Modified: Tue, 25 Apr 2017 07:04:07 GMT
Etag: f688ae26e9cfa3ba6235477831d5122e
X-Timestamp: 1493103846.44231
X-Object-Meta-Book: GoodbyeOldFriend
Content-Type: application/x-www-form-urlencoded
X-Trans-Id: txb8013a1c8ae7478482080-0058fef4f8
X-Openstack-Request-Id: txb8013a1c8ae7478482080-0058fef4f8
Date: Tue, 25 Apr 2017 07:04:24 GMT

============================================================================================================================================

GET     /v1/endpoints       List endpoints

--------------------------------------------------------------------------------------------------------------------------------------------

No ideal

============================================================================================================================================

 

SAIO - curl sample

标签:==   pos   abi   show   cti   open   roc   www   div   

原文地址:http://www.cnblogs.com/submarinex/p/6762234.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!