-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdelete_treatment
executable file
·37 lines (31 loc) · 952 Bytes
/
delete_treatment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
export PATH=`dirname $0`:${PATH}
export LC_ALL=C
. .settings || exit 99
SECRETSHA1=`echo -n ${SECRET} | sha1sum - | cut -c1-40`
id=${1:-0}
# do not use -i as json_pp will choke on it
echo "Selected treatment record:"
curl \
-H "API-SECRET: ${SECRETSHA1}" \
-H 'Accept: */*' \
-H 'Content-Type: application/json' \
"https://${SERVER}:${PORT}/api/v1/treatments.json?x=1&count=10&find\[_id\]=${id}" \
| json_pp
echo ""
read -p "proceed? " x
curl \
-X DELETE \
-H "API-SECRET: ${SECRETSHA1}" \
-H 'Accept: */*' \
-H 'Content-Type: application/json' \
"https://${SERVER}:${PORT}/api/v1/treatments.json?x=2&count=10&find\[_id\]=${id}"
echo ""
#read -p "proceed? " x
echo "Check for treatment record:"
curl \
-H "API-SECRET: ${SECRETSHA1}" \
-H 'Accept: */*' \
-H 'Content-Type: application/json' \
"https://${SERVER}:${PORT}/api/v1/treatments.json?x=3&count=10&find\[_id\]=${id}"
echo ""