Skip to content

Instantly share code, notes, and snippets.

@dabear
Created May 2, 2017 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dabear/b39d1160d3fcb34c60094732667c21e3 to your computer and use it in GitHub Desktop.
Save dabear/b39d1160d3fcb34c60094732667c21e3 to your computer and use it in GitHub Desktop.
API_SECRET="somelongsecret"
URL="foo.herokuapp.com"
NOW=$(date +%s%N | cut -b1-13)
read -d '' json << FOO
{
"sgv": 55,
"type": "sgv",
"direction": "Flat",
"date": $NOW
}
FOO
sha1sum=$(echo -n "$API_SECRET" | sha1sum | awk '{print $1}')
curl -H "Content-Type: application/json" -H "api-secret: $sha1sum" -POST "https://$URL/api/v1/entries/" -d "$json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment