You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modified to accommodate the content model code examples and restrict examples only with the defined endpoints.
Ideal workflow:
1. User select option 44.
2.User selects the default envelope id created using Step 2 or enter his own envelope id.
3. Envelope gets deleted and asks for user confirmation to check in the UI.
4. User enters the name of the destination folder where the restored envelope to be moved.
5. Moves the envelope to the destination folder.
The new code snippet are introduced to follow the content model such as
1. Defining the headers.
2. Creating a requesting body
And used Folders Endpoint (as suggested by Sigma team).
Signed-off-by: Balaji Jayaraman <[email protected]>
--request PUT "${base_path}/v2.1/accounts/${account_id}/folders/recyclebin" \
71
-
--data-raw '{
72
-
"envelopeIds": [
73
-
"'${envelope_id}'"
74
-
]
75
-
}'
76
-
#ds-snippet-end:eSign45Step2
73
+
# Create the request body for deleting the envelope
74
+
request_body=$(mktemp)
75
+
#ds-snippet-start:eSign45Step3
76
+
printf'{
77
+
"envelopeIds": [
78
+
"%s"
79
+
]
80
+
}'"${envelope_id}">$request_body
81
+
#ds-snippet-end:eSign45Step3
82
+
83
+
#ds-snippet-start:eSign45Step4
84
+
curl --request PUT "${base_path}/v2.1/accounts/${account_id}/folders/recyclebin" \
85
+
"${Headers[@]}" \
86
+
--data-binary @${request_body}
87
+
#ds-snippet-end:eSign45Step4
77
88
78
89
echo""
79
90
echo""
80
91
echo"The deleted envelope is now in your Docusign Recycle Bin."
81
92
echo"You can check your web app to confirm the deletion."
82
93
83
94
84
-
# PART 2: Pause for User Confirmation
95
+
# PART 2: Pause for User Confirmation and Get the Destination Folder Name from User
85
96
86
97
echo""
87
98
read -p "Press Enter to proceed with restoring the envelope from the Recycle Bin..."
88
99
89
-
# PART 3: Restore the Envelope
100
+
# Prompt for the destination folder name and handle spaces
101
+
read -p "Please enter the name of the folder to undelete the envelope to (e.g., 'Sent Items') or press Enter to use the default: " destination_folder_name
102
+
# Set default folder if none is provided
103
+
if [ -z"$destination_folder_name" ];then
104
+
destination_folder_name="Sent Items"
105
+
echo"The undeleted item will be moved to the Sent Items folder."
106
+
fi
107
+
108
+
# PART 3: Find the Folder ID
109
+
110
+
echo"Searching for folder with name: '${destination_folder_name}'..."
# Find the specific folder entered and extract its folderId
119
+
120
+
folder_id=$(echo "${RESPONSE}"| grep -oi "\"name\":\"${destination_folder_name}\",\"type\":\"[^\"]*\",\"owner\":{[^\}]*},\"folderId\":\"[^\"]*\""| sed 's/.*"folderId":"//'| sed 's/"$//')
121
+
#ds-snippet-end:eSign45Step5
122
+
if [ -z"$folder_id" ];then
123
+
echo"ERROR: Could not find a folder with the name '${destination_folder_name}'. Please check the spelling."
124
+
fi
125
+
126
+
echo"Found folder ID: ${folder_id} for folder name: '${destination_folder_name}'"
127
+
128
+
# PART 4: Undelete the Envelope
90
129
91
130
echo""
92
-
echo"Restoring the Envelope from Recycle Bin to the Sent Items folder."
131
+
echo"Restoring the Envelope from Recycle Bin to the '${destination_folder_name}' folder."
0 commit comments