#!/usr/bin/env bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" KEY= HOST="http://localhost:3000" if [ ! -d $SCRIPT_DIR/dashboards ] ; then mkdir -p $SCRIPT_DIR/dashboards fi for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |sed 's/{"id"/\\\n{"id"/g' |cut -d "," -f 3 | grep db |cut -d\" -f 4 |cut -d\/ -f2); do curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash | sed 's/"id":[0-9]\+,/"id":null,/' | sed 's/\(.*\)}/\1,"overwrite": true}/' > $SCRIPT_DIR/dashboards/$dash.json done