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 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

============================================================================================================================================
时间: 2024-10-17 03:08:21

SAIO - curl sample的相关文章

php curl 发送get或者post请求

php可以扮演资料的发送者. 简单的get $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://SomeDomain/SamplePath?SomeVar=test"); curl_exec($ch); curl_close($ch); 2.  简单的post $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://SomeDomain/SamplePath

linux下c/c++方式访问curl的帮助手册

自:http://blog.chinaunix.net/u1/47395/showart_1768832.html 有个业务需求需要通过curl 代理的方式来访问外网 百度了一把,测试可以正常使用.记录下来方便后续查找 example:   1. http://curl.haxx.se/libcurl/c/example.html  2. http://www.libcurl.org/book:  1. http://www.linuxdevcenter.com/pub/a/linux/2005

微信支付错误两个问题的解决:curl出错,错误码:60

如下是运行微信支付测试代码时出错代码: Warning: curl_setopt() expects parameter 2 to be long, string given in D:\wwwroot\weixinpaytest\pay\WxPay.JsApiPay.php on line 99 Fatal error: Uncaught exception 'WxPayException' with message 'curl出错,错误码:60' in D:\wwwroot\weixinpa

php curl 伪造IP来源的实例代码

curl发出请求的文件fake_ip.php: 代码 代码如下: <?php $ch = curl_init(); $url = "http://localhost/target_ip.php"; $header = array( 'CLIENT-IP:58.68.44.61', 'X-FORWARDED-FOR:58.68.44.61', ); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPH

Linux系统curl命令

curl命令 curl  -I  网址    //-I :省略源代码查看,内容如下: 我们查看的是HTTP/1.1 200 OK 这一行 常用状态吗有:200 301 302 404 403 502 503 上述状态码中,只有  200 是OK 的 如果出现301 302 ,它可能是因为在服务端设置了  跳转 ,内容如下: 上图显示,HTTP/1.1 301 设置了跳转,跳转到了下面:Location:http://www.aminglinux.com/bbs/forum.php -x  可以指

关于curl跳转抓取

今天在公司碰到了一个bug,就是以前一直用curl下载的MP3录音文件为空了,但是浏览器去get请求是有文件的,并且大小还不是0kb,但是我用curl下载下来就是0K,百思不得其解.终于功夫不负有心人,得到了方法,原来我一直要去第三方的接口拿到录音数据,但是今天的录音数据中地址跳转了,也就是第一次请求的地址返回的是302, 这是以前的代码 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // curl_setopt($ch, CUR

php+curl上传文件

因为公司项目用java做的,需要我这边用php上传文件.只给了个接口,参数都不明确,然后这边不提交表单,在生成pdf之后就立马上传.用了php+curl,总是没上传成功,这里看到了篇文章http://blog.sina.com.cn/s/blog_709475a101013dlf.html,希望可以借鉴.还有这篇http://www.cnblogs.com/jackluo/p/4113255.html

curl 命令获取网络网站的响应码

curl命令参数很多,博主很多都没有用过.今天发现可以用-w参数挺好用的. -w:--write-out,作用就是输出点什么.curl的-w参数用于在一次完整且成功的操作后输出指定格式的内容到标准输出.输出格式由普通字符串和任意数量的变量组成,输出变量需要按照%{variable_name}的格式,如果需要输出%,double一下即可,即%%,同时,\n是换行,\r是回车,\t是TAB.curl会用合适的值来替代输出格式中的变量,所有可用变量如下: url_effective 最终获取的url地

php使用curl提交xml数据

$str_callback_url="xxxx.com/api.php";$str_callback_url="xml数据";$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $str_callback_url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);curl_setopt($ch,