TASKPM/scripts/rest-clients/import-cost-categories.sh
Susana Montes Pedreira 59b6776b8c ItEr50S13AdaptacionServiciosRESTItEr49S18 : Creation and Adapting of CostCategoryServiceRest to GenericServiceRest.
Important : it should be to add the column code to the table costcategory and the table hourcost.
2010-03-15 14:22:21 +01:00

33 lines
698 B
Bash
Executable file

#!/bin/sh
. ./rest-common-env.sh
printf "Login name: "
read loginName
printf "Password: "
read password
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
certificate=$DEVELOPMENT_CERTIFICATE
for i in "$@"
do
if [ "$i" = "--prod" ]; then
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
certificate=$PRODUCTION_CERTIFICATE
else
file=$i
fi
done
if [ "$file" = "" ]; then
printf "Missing file\n" 1>&2
exit 1
fi
authorization=`./base64.sh $loginName:$password`
curl -sv -X POST $certificate -d @$file \
--header "Content-type: application/xml" \
--header "Authorization: Basic $authorization" \
$baseServiceURL/costcategories | tidy -xml -i -q -utf8