Browse Source

test script for update a line

nas 3 years ago
parent
commit
6da2826b63
1 changed files with 39 additions and 0 deletions
  1. 39
    0
      test/set_line.sh

+ 39
- 0
test/set_line.sh View File

@@ -0,0 +1,39 @@
1
+#/bin/sh
2
+
3
+help() {
4
+    echo "Syntaxe"
5
+    echo "‾‾‾‾‾‾‾"
6
+    echo "sh $0 [ adresse ] [ table ] [ id ] [ data ]\n"
7
+}
8
+
9
+if [ -z "$1" ]
10
+then
11
+    echo "Missing parameters : web adresses is needed\n"
12
+    help
13
+    exit
14
+fi
15
+if [ -z "$2" ]
16
+then
17
+    echo "Missing parameters : tablename is needed\n"
18
+    help
19
+    exit
20
+fi
21
+
22
+if [ -z "$3" ]
23
+then
24
+    echo "Missing parameters : an id is needed\n"
25
+    help
26
+    exit
27
+fi
28
+if [ -z "$4" ]
29
+then
30
+    echo "Missing parameters : data are needed\n"
31
+    help
32
+    exit
33
+fi
34
+
35
+echo "Set data for $2 with id $3"
36
+echo "$1 $2 $3 $4"
37
+echo curl --header "Content-Type: application/json" -b cookie.txt --data "$4" $1/api.php/records/$2/$3
38
+curl --header "Content-Type: application/json" -b cookie.txt -X PUT --data "$4" $1/api.php/records/$2/$3
39
+echo "\n"

Loading…
Cancel
Save