From 9ed959548224095c5aa8ce1e1a4d90b2ee03548e Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Wed, 7 Nov 2012 22:51:28 +0100 Subject: [PATCH] Add example scripts to import personal timesheets data FEA: ItEr77S14BoundUsersWebServices --- .../bound-user-import-personal-timesheet.sh | 42 +++++++++++++++++++ scripts/rest-clients/personal-timesheet.xml | 4 ++ 2 files changed, 46 insertions(+) create mode 100755 scripts/rest-clients/bound-user-import-personal-timesheet.sh create mode 100644 scripts/rest-clients/personal-timesheet.xml diff --git a/scripts/rest-clients/bound-user-import-personal-timesheet.sh b/scripts/rest-clients/bound-user-import-personal-timesheet.sh new file mode 100755 index 000000000..a659251ef --- /dev/null +++ b/scripts/rest-clients/bound-user-import-personal-timesheet.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +. ./rest-common-env.sh + +printf "BOUND USER\n" +printf "Username: " +read loginName +printf "Password: " +read password + +file=$1 + +if [ "$1" = "--prod" ]; then + baseServiceURL=$PRODUCTION_BASE_SERVICE_URL + certificate=$PRODUCTION_CERTIFICATE + file=$2 +elif [ "$1" = "--dev" ]; then + baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL + certificate=$DEVELOPMENT_CERTIFICATE + file=$2 +else + baseServiceURL=$DEMO_BASE_SERVICE_URL + certificate=$DEMO_CERTIFICATE +fi + +if [ "$file" = "" ]; then + printf "Missing file\n" 1>&2 + exit 1 +fi + +authorization=`echo -n "$loginName:$password" | base64` + +result=`curl -sv -X POST $certificate -d @$file \ + --header "Content-type: application/xml" \ + --header "Authorization: Basic $authorization" \ + $baseServiceURL/bounduser/timesheets/` + +if hash tidy &> /dev/null; then + echo $result | tidy -xml -i -q -utf8 +else + echo $result +fi diff --git a/scripts/rest-clients/personal-timesheet.xml b/scripts/rest-clients/personal-timesheet.xml new file mode 100644 index 000000000..16d51dbf7 --- /dev/null +++ b/scripts/rest-clients/personal-timesheet.xml @@ -0,0 +1,4 @@ + + + +