curl

curl -d '{"key": "value"}' -X POST -H 'Content-Type: application/json' http://localhost:8080/post

To send the content of a file:

-d @filename.json 

To accept a JSON response (a GET request i.e.):

-H 'Accept: application/json'

To post an HTML form:

-H "Content-Type: application/x-www-form-urlencoded" 
-d "param1=value1¶m2=value2"

Ignore SSL errors:

-k

To authenticate basic HTTP:

-u "login:password"

To download a file:

-o filename.txt

Tags linux command

Back