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.
33 lines
699 B
Bash
Executable file
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
|