Last active
August 29, 2015 14:05
-
-
Save cybersamx/10a389381e069e689a18 to your computer and use it in GitHub Desktop.
Commonly used CURL commands for testing/debugging
This file contains hidden or 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
# GET a JSON result. | |
curl -i -H "Accept: Application/json" -H "Content-Type: application/json" http://localhost/sessions.json | |
# POST a JSON result. | |
curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" -d '{"id":"IDVALUE","name":"Sam"}' http://localhost/sessions.json | |
# Use cookies (write/read). | |
curl -c cookies.txt -b cookies.txt http://localhost/users.json | |
# Follow redirection. | |
curl -L http://localhost | |
# Add a custom header Authorization. | |
curl --header "Authorization: MyAPIKey" http://localhost/users.json | |
# Reference <http://stackoverflow.com/questions/14978411/http-post-and-get-using-curl-in-linux> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment