Skip to content

Commit 10ed78b

Browse files
committed
Update Examples/eg001EmbeddedSigning.sh
1 parent 7481dc2 commit 10ed78b

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

Examples/eg001EmbeddedSigning.sh

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
8484
echo ""
8585
echo "Response:"
8686
cat $response
87+
echo ""
8788

8889
# pull out the envelopeId
89-
ENVELOPE_ID=`cat $response | grep envelopeId | sed 's/.*\"envelopeId\": \"//' | sed 's/\",//'`
90-
echo "EnvelopeId: |${ENVELOPE_ID}|"
90+
ENVELOPE_ID=`cat $response | grep envelopeId | sed 's/.*\"envelopeId\": \"//' | sed 's/\",//' | tr -d '\r'`
91+
echo "EnvelopeId: ${ENVELOPE_ID}"
9192

9293

9394
# Step 2. Create a recipient view (a signing ceremony view)
@@ -98,6 +99,7 @@ echo "EnvelopeId: |${ENVELOPE_ID}|"
9899
# For this example, we'll use http://httpbin.org/get to show the
99100
# query parameters passed back from DocuSign
100101

102+
echo "Request the url for the signing ceremony..."
101103
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
102104
--header "Content-Type: application/json" \
103105
--data-binary '
@@ -112,24 +114,25 @@ curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
112114
--output ${response}
113115

114116
echo ""
115-
echo "Get recipient view response:"
117+
echo "Response:"
116118
cat $response
119+
echo ""
117120

118-
119-
120-
#echo ""
121-
#echo ""
122-
#echo "Files"
123-
#echo "$request_data"
124-
#echo "$doc1_base64"
125-
#echo "$doc2_base64"
126-
#echo "$doc3_base64"
121+
REDIRECT_URL=`cat $response | grep url | sed 's/.*\"url\": \"//' | sed 's/\"//' | tr -d '\r'`
122+
echo ""
123+
echo "Attempting to automatically open your browser to the signing ceremony url..."
124+
if which open > /dev/null 2>/dev/null
125+
then
126+
open "$REDIRECT_URL"
127+
elif which start > /dev/null
128+
then
129+
start "$REDIRECT_URL"
130+
fi
127131

128132
# cleanup
129133
rm "$request_data"
134+
rm "$response"
130135
rm "$doc1_base64"
131-
rm "$doc2_base64"
132-
rm "$doc3_base64"
133136

134137
echo ""
135138
echo ""

0 commit comments

Comments
 (0)