Skip to content

Commit 8e63dd1

Browse files
author
nianiB9
committed
resume workflow
1 parent 2e8220d commit 8e63dd1

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# Resume a paused workflow instance
3+
#
4+
# Check that we're in a bash shell
5+
if [[ $SHELL != *"bash"* ]]; then
6+
echo "PROBLEM: Run these scripts from within the bash shell."
7+
fi
8+
9+
# Check that there is a workflow
10+
workflow_id=$(cat config/WORKFLOW_ID)
11+
if [ -z "$workflow_id" ]; then
12+
echo "Please run example 1 to create and trigger a workflow before running this example."
13+
exit 0
14+
fi
15+
16+
# Obtain your OAuth token
17+
# Note: Substitute these values with your own
18+
ACCESS_TOKEN=$(cat config/ds_access_token.txt)
19+
20+
# Set up variables
21+
# Note: Substitute these values with your own
22+
ACCOUNT_ID=$(cat config/API_ACCOUNT_ID)
23+
base_path="https://api-d.docusign.com/v1"
24+
25+
# Construct your API headers
26+
#ds-snippet-start:Maestro3Step2
27+
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
28+
'--header' "Accept: application/json" \
29+
'--header' "Content-Type: application/json")
30+
#ds-snippet-end:Maestro3Step2
31+
32+
echo ""
33+
echo "Attempting to resume the Workflow..."
34+
echo ""
35+
36+
# Make the API call to resume
37+
#ds-snippet-start:Maestro3Step3
38+
response=$(mktemp /tmp/response-wftmp.XXXXXX)
39+
Status=$(
40+
curl -w '%{http_code}' --request POST "${base_path}/accounts/${ACCOUNT_ID}/workflows/${workflow_id}/actions/resume" \
41+
"${Headers[@]}" \
42+
--output ${response}
43+
)
44+
45+
if [[ "$Status" -gt "201" ]]; then
46+
echo ""
47+
echo "Unable to resume workflow: ${workflow_id}"
48+
echo ""
49+
cat $response
50+
exit 0
51+
fi
52+
53+
echo ""
54+
echo "Workflow has been resumed."
55+
echo ""
56+
echo "Response:"
57+
cat $response
58+
echo ""
59+
#ds-snippet-end:Maestro3Step3
60+
61+
# Remove the temporary files
62+
rm "$response"

launcher.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ function startMaestro() {
976976
select CHOICE in \
977977
"Trigger_Workflow" \
978978
"Pause_Workflow" \
979+
"Resume_Workflow" \
979980
"Cancel_Workflow" \
980981
"Home"; do
981982
case "$CHOICE" in
@@ -990,6 +991,10 @@ function startMaestro() {
990991
bash examples/Maestro/eg002PauseWorkflow.sh
991992
startMaestro
992993
;;
994+
Resume_Workflow)
995+
bash examples/Maestro/eg003ResumeWorkflow.sh
996+
startMaestro
997+
;;
993998
Cancel_Workflow)
994999
bash examples/Maestro/eg004CancelWorkflow.sh
9951000
startMaestro

0 commit comments

Comments
 (0)