Created
September 11, 2013 00:46
-
-
Save saneshark/6517942 to your computer and use it in GitHub Desktop.
curl / shell scripts for testing apis
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
#!/bin/bash | |
CURL='/usr/bin/curl' | |
MAINURL="https://api.myserver.com" | |
ACTION="users" | |
USERNAME="[email protected]" | |
PASSWORD="secret" | |
PARAMS_TO_TEST="&company_id=1" | |
CURLARGS="-k" | |
PATH_TO_STORE="./output.xml" | |
EXECUTE=$MAINURL/$ACTION'?username='$USERNAME'&password='$PASSWORD$PARAMS_TO_TEST | |
echo "executing curl $EXECUTE" | |
$CURL $CURLARGS $EXECUTE > $PATH_TO_STORE | |
echo "output saved to file output.xml" |
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
#!/bin/bash | |
CURL='/usr/bin/curl' | |
MAINURL="https://api.myserver.com/" | |
ACTION="users/create" | |
PARAMS_TO_TEST="" | |
CURLARGS="-k -d @post.xml -H 'Content-type: application/xml'" | |
PATH_TO_STORE="./output.xml" | |
EXECUTE=$MAINURL/$ACTION'?username='$USERNAME'&password='$PASSWORD$PARAMS_TO_TEST | |
echo "executing curl $EXECUTE" | |
$CURL $CURLARGS $EXECUTE > $PATH_TO_STORE | |
echo "output saved to file output.xml" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment