Skip to content

Instantly share code, notes, and snippets.

View sleitner's full-sized avatar

Sam Leitner sleitner

  • Data scientist
  • Boulder, CO
View GitHub Profile
#!/bin/bash
# Mostly copied from https://github.com/gf3/dotfiles
# Note: The character just before \[$RESET\ at line 53 is an emoji -- add your fav: http://osxdaily.com/2013/04/08/add-emoji-command-line-bash-prompt
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
fi
@sleitner
sleitner / curl_datastore.sh
Last active August 29, 2015 14:23
Interacting with datastore API
API_KEY='<INSERT YOUR API KEY>'
SITE_API='<CKAN WEBSITE:PORT>/api/3/action/'
RES_ID='<INSERT CREATED RESOURCE ID>'
#create
echo '----------------create'
curl -X POST ${SITE_API}/datastore_create -H "Authorization: ${API_KEY}" -d '{"force":"true", "resource_id":"'${RES_ID}'", "primary_key":["name"], "fields": [{"id":"name"},{"id":"tab", "type":"json"}],"records" : [ {"name": "datadict", "tab": [{"item1_int":1,"item2_txt":"xyz"}] } ]}'; echo '';
curl -X POST ${SITE_API}/datastore_create -H "Authorization: ${API_KEY}" -d '{"force":"true", "resource_id":"'${RES_ID}'", "records" : [ {"name": "otherdata", "tab": [{"k1":1,"k2":2}] } ]}'; echo '';
#show