File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ curl_with_retry() {
22
22
local data_file=" $6 "
23
23
local retry_count=0
24
24
25
+ local temp_file=" "
25
26
# Create temp file if data is provided (either as string or file)
26
27
if [[ -n " $data_file " ]]; then
27
28
temp_file=" $data_file "
@@ -88,7 +89,7 @@ curl_with_retry() {
88
89
rm -f " $temp_file "
89
90
fi
90
91
91
- if [[ " $status_code " == " 200 " || " $status_code " == " 201 " ]]; then
92
+ if [[ " $status_code " =~ ^2[0-9][0-9]$ ]]; then
92
93
echo " $response_body "
93
94
return 0
94
95
else
380
381
381
382
if [[ $curl_exit_code -eq 0 && -n " $response " ]]; then
382
383
# Extract target ID from response
383
- target_id=$( echo " $response " | grep -o ' "id":"[^"]*" ' | cut -d ' " ' -f4 )
384
+ target_id=$( echo " $response " | jq -r ' .id // empty ' )
384
385
if [[ -n " $target_id " ]]; then
385
386
echo " Target created successfully with ID: $target_id " >&2
386
387
echo " $target_id "
486
487
487
488
if [[ $curl_exit_code -eq 0 && -n " $response " ]]; then
488
489
# Extract dashboard ID from response
489
- dashboard_id=$( echo " $response " | grep -o ' " dashboardId":"[^"]*" ' | cut -d ' " ' -f4 )
490
+ dashboard_id=$( echo " $response " | jq -r ' . dashboardId // empty ' )
490
491
if [[ -n " $dashboard_id " ]]; then
491
492
echo " Dashboard created successfully with ID: $dashboard_id " >&2
492
493
echo " $dashboard_id "
You can’t perform that action at this time.
0 commit comments