Skip to content

Commit 87181c3

Browse files
committed
Added changes to the workspace examples
1 parent 95d0a8c commit 87181c3

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

examples/Workspaces/eg001CreateWorkspace.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@ declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
2626
'--header' "Content-Type: application/json")
2727
#ds-snippet-end:Workspaces1Step2
2828

29+
# Enter the name of the workspace to creat
30+
echo ""
31+
echo "Enter the name for the new workspace:"
32+
echo ""
33+
34+
read workspace_name
35+
2936
# Create the workspace definition
3037
#apx-snippet-start:createWorkspace
3138
#ds-snippet-start:Workspaces1Step3
3239
printf \
3340
'{
34-
"name" : "Example workspace"
41+
"name" : "'"${workspace_name}"'"
3542
}' >> $request_data
3643
#ds-snippet-end:Workspaces1Step3
3744

examples/Workspaces/eg002AddDocumentToWorkspace.sh

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,31 @@ declare -a Headers=(
3535
)
3636
#ds-snippet-end:Workspaces2Step2
3737

38+
DOCUMENTS_DIR="demo_documents"
3839

3940
# Upload the file path to be added to the workspace
4041
#ds-snippet-start:Workspaces2Step3
41-
echo ""
42-
echo "Enter the path to the document you want to add to the workspace:"
43-
echo ""
44-
read file_path
45-
46-
if [ ! -f "$file_path" ]; then
47-
echo "File does not exist: $file_path"
48-
exit 1
49-
fi
42+
while true; do
43+
echo ""
44+
echo "Enter the PDF file name (e.g. World_Wide_Corp_Web_Form.pdf) from the demo_documents folder:"
45+
echo ""
46+
read file_name
47+
48+
file_path="$DOCUMENTS_DIR/$file_name"
49+
50+
if [[ "$file_name" != *.pdf ]]; then
51+
echo ""
52+
echo "The file must be a PDF (must end with .pdf). Please try again."
53+
continue
54+
fi
55+
56+
if [ ! -f "$file_path" ]; then
57+
echo ""
58+
echo "File not found in demo_documents folder."
59+
continue
60+
fi
61+
break
62+
done
5063

5164
# Enter the document name for the workspace
5265
echo ""

0 commit comments

Comments
 (0)