File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,10 @@ data=$(jq --arg name $username --arg pass $password --arg dname $domainname --ar
8484jwt=$( curl -k -X POST $uri -H $content_header -d " $data " | jq --raw-output ' .token' )
8585
8686param1=" filter=policyType eq 'Standard'"
87- param2=" page[limit]=10"
87+
88+ # ## To use filter page[limit] in URI, The key 'page[limit]' must be url encoded already. ###
89+ # ## Curl --data-urlencode encodes only the content part of the data of the form 'name=content' ###
90+ param2=" $( uriencode ' page[limit]' ) =10" # op: page%5Blimit%5D=10
8891
8992# #############jobs##############
9093
Original file line number Diff line number Diff line change @@ -67,12 +67,17 @@ parseArguments()
6767 fi
6868}
6969
70+ uriencode ()
71+ {
72+ jq -nr --arg v " $1 " ' $v|@uri' ;
73+ }
74+
7075# ##############main#############
7176
7277parseArguments " $@ "
7378
7479basepath=" https://$master_server :$port /netbackup"
75- content_header=' content-type:application/json'
80+ content_header=' content-type:application/json;charset=utf-8 '
7681
7782# #############login#############
7883
@@ -84,14 +89,17 @@ data=$(jq --arg name $username --arg pass $password --arg dname $domainname --ar
8489jwt=$( curl -k -X POST $uri -H $content_header -d " $data " | jq --raw-output ' .token' )
8590
8691param1=" filter=jobType eq 'BACKUP'"
87- param2=" page[limit]=10"
92+
93+ # ## To use filter page[limit] in URI, The key 'page[limit]' must be url encoded already. ###
94+ # ## Curl --data-urlencode encodes only the content part of the data of the form 'name=content' ###
95+ param2=" $( uriencode ' page[limit]' ) =10" # op: page%5Blimit%5D=10
8896
8997# #############jobs##############
9098
9199auth_header=" authorization:$jwt "
92100uri=" $basepath /admin/jobs"
93101
94- curl --insecure --request GET --globoff --get $uri -H $content_header -H $auth_header \
102+ curl --verbose -- insecure --request GET --get $uri -H $content_header -H $auth_header \
95103 --data-urlencode " $param1 " \
96104 --data-urlencode " $param2 " \
97105 | \
You can’t perform that action at this time.
0 commit comments