Add example scripts to import personal timesheets data

FEA: ItEr77S14BoundUsersWebServices
This commit is contained in:
Manuel Rego Casasnovas 2012-11-07 22:51:28 +01:00
parent fac20ff303
commit 9ed9595482
2 changed files with 46 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<personal-timesheet-entry-list xmlns="http://rest.ws.libreplan.org">
<personal-timesheet-entry effort="8" date="2012-11-08" task="ORDER0001-0001"/>
</personal-timesheet-entry-list>