Created
May 30, 2017 10:21
-
-
Save ivansostarko/2e4971bd2298951e7b7d7cde104610e7 to your computer and use it in GitHub Desktop.
Logging Rest API using cURL
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
#!/bin/bash | |
# API log description | |
echo "Started TIME: $(date '+%d/%m/%Y %H:%M:%S')" > api.log | |
for i in {1..1000000} | |
do | |
echo " | |
Executed times: $i | |
str: $(date '+%d/%m/%Y %H:%M:%S.%N')" >> api.log; | |
curl -H "X-Authorization: api-key" --data "param_1=one¶m_2=2" https://api.com/v1 >> api.log; | |
echo " | |
end: $(date '+%d/%m/%Y %H:%M:%S.%N')" >> api.log; | |
done | |
echo "Ended TIME: $(date '+%d/%m/%Y %H:%M:%S')" >> api.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to run script:
Rename file to .sh
chmod +x curl_rest_api_logging.sh
Edit values in curl
Run script ./curl_rest_api_logging.sh