Last active
April 16, 2017 11:53
-
-
Save freemanlutsk/00be3149bae85e0835f264ca6ec59997 to your computer and use it in GitHub Desktop.
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 | |
# Use https://ticket.appodeal.com/my/account for getting API key (on the right side "API access key") | |
API_KEY="XXX" | |
TICKETS_LINK="https://ticket.XXX.com/time_entries.json" | |
# Loading data | |
# bash ticket.sh logfile.csv | |
# Don't use empty lines in logfile.csv. | |
# e.g. logfile.csv | |
# 8086|2017-04-02|3|Comment 456 | |
# ... | |
# 8086|2017-04-30|8.5|Коментарий 123. | |
while read i; do | |
echo -n "." | |
echo | |
ISSUE_ID=$(echo $i|awk -F "|" '{print $1}') | |
SPENT_ON=$(echo $i|awk -F "|" '{print $2}') | |
HOURS=$(echo $i|awk -F "|" '{print $3}') | |
COMMENTS=$(echo $i|awk -F "|" '{print $4}') | |
curl -s -H "Content-Type: application/json" -X POST -d '{"time_entry":{"issue_id": "'"$ISSUE_ID"'", "spent_on": "'"$SPENT_ON"'", "hours": "'"$HOURS"'", "comments": "'"$COMMENTS"'"}}' -H "X-Redmine-API-Key: $API_KEY" $TICKETS_LINK | |
echo | |
echo "$SPENT_ON Done!" | |
done < $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment