TASKPM/scripts/rest-clients/post-criterions-types.sh
Fernando Bellas Permuy e4d9fa0e01 ItEr40S20CUImportacionRecursosProductivosItEr39S23: "scripts/rest-clients" folder has been created with initial scripts for REST clients.
The new foler includes a README file (please, update it when adding new scripts), common scripts (base64.sh and rest-common-env.sh), two scripts (post-criterions-types.sh and get-criterion-types.sh) for importing/exporting criterion types, and a sample file (criterion-types-sample.xml) with criterion types to be imported.
2009-12-23 13:53:13 +01:00

33 lines
699 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/criteriontypes | tidy -xml -i -q -utf8