diff --git a/scripts/rest-clients/README b/scripts/rest-clients/README index 44b19c3da..394b15daa 100644 --- a/scripts/rest-clients/README +++ b/scripts/rest-clients/README @@ -28,6 +28,20 @@ - Check the returned errors are consistent with the comments in resources-sample.xml. + * Export order elements: + + - export-order-element.sh ORDER-ELEMENT-CODE (authenticate with + wsreader/wsreader) + + * Import orders: + + - import-order.sh order-sample.xml (authenticate with wswriter/wswriter) + + * Update orders: + + - update-order.sh order-update-sample.xml (authenticate with + wswriter/wswriter) + + When working with the online demo: * import-criterions-types.sh --prod criterion-types-sample.xml @@ -37,3 +51,12 @@ * import-resources.sh --prod resources-sample.xml (authenticate with wswriter/wswriter) + + * export-order-element.sh --prod ORDER-ELEMENT-CODE (authenticate with + wsreader/wsreader) + + * import-order.sh --prod order-sample.xml (authenticate with + wswriter/wswriter) + + * update-order.sh --prod order-update-sample.xml (authenticate with + wswriter/wswriter) diff --git a/scripts/rest-clients/export-order-element.sh b/scripts/rest-clients/export-order-element.sh new file mode 100755 index 000000000..4e000ea6d --- /dev/null +++ b/scripts/rest-clients/export-order-element.sh @@ -0,0 +1,31 @@ +#!/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 + orderElementCode=$i + fi +done + +if [ "$orderElementCode" = "" ]; then + printf "Missing order element code\n" 1>&2 + exit 1 +fi + +authorization=`./base64.sh $loginName:$password` + +curl -sv -X GET $certificate --header "Authorization: Basic $authorization" \ + $baseServiceURL/orderelements/$orderElementCode/ | tidy -xml -i -q -utf8 diff --git a/scripts/rest-clients/import-criterions-types.sh b/scripts/rest-clients/import-criterions-types.sh index 6436a63e9..2b189484a 100755 --- a/scripts/rest-clients/import-criterions-types.sh +++ b/scripts/rest-clients/import-criterions-types.sh @@ -22,7 +22,7 @@ done if [ "$file" = "" ]; then printf "Missing file\n" 1>&2 - exit -1 + exit 1 fi authorization=`./base64.sh $loginName:$password` diff --git a/scripts/rest-clients/import-order.sh b/scripts/rest-clients/import-order.sh new file mode 100755 index 000000000..7087dc56d --- /dev/null +++ b/scripts/rest-clients/import-order.sh @@ -0,0 +1,33 @@ +#!/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/orderelements/ | tidy -xml -i -q -utf8 diff --git a/scripts/rest-clients/import-resources.sh b/scripts/rest-clients/import-resources.sh index 18ea8298c..e1d9c7323 100755 --- a/scripts/rest-clients/import-resources.sh +++ b/scripts/rest-clients/import-resources.sh @@ -22,7 +22,7 @@ done if [ "$file" = "" ]; then printf "Missing file\n" 1>&2 - exit -1 + exit 1 fi authorization=`./base64.sh $loginName:$password` diff --git a/scripts/rest-clients/order-sample.xml b/scripts/rest-clients/order-sample.xml new file mode 100644 index 000000000..c10e0624a --- /dev/null +++ b/scripts/rest-clients/order-sample.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/rest-clients/order-update-sample.xml b/scripts/rest-clients/order-update-sample.xml new file mode 100644 index 000000000..1bd340d07 --- /dev/null +++ b/scripts/rest-clients/order-update-sample.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/rest-clients/update-order.sh b/scripts/rest-clients/update-order.sh new file mode 100755 index 000000000..750f74a17 --- /dev/null +++ b/scripts/rest-clients/update-order.sh @@ -0,0 +1,33 @@ +#!/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 PUT $certificate -d @$file \ + --header "Content-type: application/xml" \ + --header "Authorization: Basic $authorization" \ + $baseServiceURL/orderelements/ | tidy -xml -i -q -utf8