2022年2月22日星期二

curl json introduction

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d @body.json -u userid:passwd http://localhost:8080/imart/logic/api/cookbook119839

Intro:

-X POST : POST or GET method.

-H "Content-Type: application/json"   : add header Content-Type

-H "Accept: application/json"              : add header Accept

-d @body.json                                   : post data with filename=body.json

-u userid:passwd                               : with userid:password

last param default url.

curl --help                           
Usage: curl [options...] <url>
 -d, --data <data>   HTTP POST data
 -f, --fail          Fail silently (no output at all) on HTTP errors
 -h, --help <category>  Get help for commands
 -i, --include       Include protocol response headers in the output
 -o, --output <file>  Write to file instead of stdout
 -O, --remote-name   Write output to a file named as the remote file
 -s, --silent        Silent mode    
 -T, --upload-file <file>  Transfer local FILE to destination
 -u, --user <user:password>  Server user and password
 -A, --user-agent <name>  Send User-Agent <name> to server
 -v, --verbose       Make the operation more talkative
 -V, --version       Show version number and quit
This is not the full help, this menu is stripped into categories.
Use "--help category" to get an overview of all categories.
For all options use the manual or "--help all".

 

没有评论: