Last active
July 26, 2018 12:54
-
-
Save aleksb86/7008c39dbac36f0bef177f749da08b74 to your computer and use it in GitHub Desktop.
Bash shorthands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CURL | |
# ------------------------------------- | |
# curl post request with no data: | |
curl -X POST http://URL/example.php | |
# curl post request with data: | |
curl -d "data=example1&data2=example2" http://URL/example.cgi | |
# curl POST to a form: | |
curl -X POST -F "name=user" -F "password=test" http://URL/example.php | |
# curl POST with a file: | |
curl -X POST -F "image=@/path/example.gif" http://URL/uploadform.cgi | |
# curl POST with JSON data: | |
curl -H "Content-Type: application/json" -X POST -d '{"user":"bob","pass":"123"}' http://URL/ | |
# curl GET with JSON: | |
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://hostname/resource | |
# curl PUT: | |
curl -X PUT -d arg=val -d arg2=val2 localhost:3000 | |
# ------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment