Skip to content

Instantly share code, notes, and snippets.

@sud0n1m
Created September 11, 2012 00:43

Revisions

  1. sud0n1m renamed this gist Sep 11, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.txt → caddy.sh
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@

    echo "Caddy v 0.1 from Customer.io"

    ENDPOINT="http://customerio.dev/api/v1/customers/"
    SITEID="49b19b01ac8c16dcc50c"
    APIKEY="ea680d288837bf95acdb"
    ENDPOINT="https://app.customer.io/api/v1/customers/"
    SITEID="YOUR SITE ID"
    APIKEY="YOUR API KEY"

    INPUT=users.csv
    OLDIFS=$IFS
  2. sud0n1m created this gist Sep 11, 2012.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash

    echo "Caddy v 0.1 from Customer.io"

    ENDPOINT="http://customerio.dev/api/v1/customers/"
    SITEID="49b19b01ac8c16dcc50c"
    APIKEY="ea680d288837bf95acdb"

    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