3 camunda="http://localhost:8080"
4 camunda_deployment="${camunda}/engine-rest/deployment"
5 deployment_name="Sentiment Analysis"
6 file_name="sentiment_analysis.bpmn"
8 # find old deployments named ${deployment_name}
9 old_ids=`curl -s ${camunda_deployment}/ | python3 -c "import sys, json; doc = json.load(sys.stdin); items = [deployment['id'] for deployment in doc if deployment['name'] == '${deployment_name}']; print (*items, sep = '\n')"`
10 # delete all old deployments
11 for old_id in ${old_ids}; do
12 curl -s -X DELETE "${camunda_deployment}/${old_id}?cascade=true"
16 curl -i "${camunda_deployment}/create" -H "Expect:" -F "deployment-name=${deployment_name}" -F "${file_name}=@${file_name}"