| Operations |
Description |
| -X |
appoint HTTP request method, like POST, GET |
| -H |
appoint request header, for example Content-type:application/json |
| -d |
appoint request data |
| –data-binary |
appoint send files |
| -i |
show response header info |
| -u |
appoint authentication username and password |
| -v |
point request header info |
For example:
1 2 3 4 5 6 7 8 9
| curl -X PATCH http://127.0.0.1:5000/echo
result: GET /echo ECHO: GET POST /ECHO ECHO: POST
|
curl -H "Content-type: application/json" \
-X POST http://127.0.0.1:5000/messages -d '{"message":"Hello Data"}'
result:
POST /messages {"message": "Hello Data"}
Content-type: application/json
JSON Message: {"message": "Hello Data"}
POST /message <message.bin>
Content-type: application/octet-stream
Binary message written!
curl -i http://127.0.0.1:5000/hello
result:
GET /hello
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 31
Link: http://luisrei.com
Server: Werkzeug/0.8.2 Python/2.7.1
Date: Wed, 25 Apr 2012 16:40:27 GMT
{"hello": "world", "number": 3}
curl -v -u "admin:secret" http://127.0.0.1:5000/secrets
# result:
GET /secrets Authorization: Basic YWRtaW46c2VjcmV0
Shhh this is top secret spy stuff!