Created
September 11, 2012 00:43
-
-
Save sud0n1m/3695125 to your computer and use it in GitHub Desktop.
Caddy -> Pump data into Customer.io from CSV
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 | |
echo "Caddy v 0.1 from Customer.io" | |
ENDPOINT="https://app.customer.io/api/v1/customers/" | |
SITEID="YOUR SITE ID" | |
APIKEY="YOUR API KEY" | |
INPUT=users.csv | |
OLDIFS=$IFS | |
IFS=, | |
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } | |
while read id email created_at first last | |
do | |
curl -i $ENDPOINT$id \ | |
-X PUT \ | |
-u $SITEID:$APIKEY \ | |
-d created_at=$created_at\ | |
-d email=$email \ | |
-d first=$first \ | |
-d last=$last | |
done < $INPUT | |
IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment