Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
New script: tool/push_data.sh
Browse files Browse the repository at this point in the history
This captures the curl command line required to push data to the
platform. Takes a bucket name and json data file.
  • Loading branch information
Paul M Furley committed Jan 9, 2014
1 parent 57ebf4a commit 81e8725
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/push_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -e

# NOTE: Set these in your environment:
# $ export WRITE_API_URL='https://www.preview.performance.service.gov.uk'
# $ export BEARER_TOKEN='xxxxx'

WRITE_API_URL=${WRITE_API_URL-http://www.perfplat.dev}
BEARER_TOKEN=${BEARER_TOKEN-invalidtoken}

if [ "$#" -ne "2" ]; then
echo "Usage: $0 <bucket> <file.json>"
exit 1
fi

set -x

curl -X POST \
--upload-file $2 \
-H "Authorization: Bearer ${BEARER_TOKEN}" \
-H 'Content-type: application/json' \
${WRITE_API_URL}/$1

0 comments on commit 81e8725

Please sign in to comment.