1616# The envelope will be sent first to the signer.
1717# After it is signed, a copy is sent to the cc person.
1818
19+ base_path=" https://demo.docusign.com/restapi"
1920# temp files:
2021request_data=$( mktemp /tmp/request-eg-001.XXXXXX)
2122response=$( mktemp /tmp/response-eg-001.XXXXXX)
@@ -33,9 +34,8 @@ printf \
3334 "documents": [
3435 {
3536 "documentBase64": "' > $request_data
36- cat $doc1_base64 >> $request_data
37- printf \
38- ' ",
37+ cat $doc1_base64 >> $request_data
38+ printf ' ",
3939 "name": "Lorem Ipsum",
4040 "fileExtension": "pdf",
4141 "documentId": "1"
@@ -76,7 +76,7 @@ printf \
7676curl --header " Authorization: Bearer {ACCESS_TOKEN}" \
7777 --header " Content-Type: application/json" \
7878 --data-binary @${request_data} \
79- --request POST https://demo.docusign.net/restapi /v2/accounts/{ACCOUNT_ID}/envelopes \
79+ --request POST ${base_path} /v2/accounts/{ACCOUNT_ID}/envelopes \
8080 --output ${response}
8181
8282echo " "
@@ -85,8 +85,8 @@ cat $response
8585echo " "
8686
8787# pull out the envelopeId
88- ENVELOPE_ID =` cat $response | grep envelopeId | sed ' s/.*\"envelopeId\": \"//' | sed ' s/\",// ' | tr -d ' \r ' `
89- echo " EnvelopeId: ${ENVELOPE_ID } "
88+ envelope_id =` cat $response | grep envelopeId | sed ' s/.*\"envelopeId\": \"//' | sed ' s/\",.*// ' `
89+ echo " EnvelopeId: ${envelope_id } "
9090
9191# Step 2. Create a recipient view (a signing ceremony view)
9292# that the signer will directly open in their browser to sign.
@@ -108,23 +108,23 @@ curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
108108 "userName": "{USER_FULLNAME}",
109109 "clientUserId": 1000,
110110}' \
111- --request POST https://demo.docusign.net/restapi/ v2/accounts/{ACCOUNT_ID}/envelopes/${ENVELOPE_ID } /views/recipient \
111+ --request POST ${base_path} / v2/accounts/{ACCOUNT_ID}/envelopes/${envelope_id } /views/recipient \
112112 --output ${response}
113113
114114echo " "
115115echo " Response:"
116116cat $response
117117echo " "
118118
119- SIGNING_CEREMONY_URL =` cat $response | grep url | sed ' s/.*\"url\": \"//' | sed ' s/\"// ' | tr -d ' \r ' `
119+ signing_ceremony_url =` cat $response | grep url | sed ' s/.*\"url\": \"//' | sed ' s/\".*// ' `
120120echo " "
121121echo " Attempting to automatically open your browser to the signing ceremony url..."
122122if which open > /dev/null 2> /dev/null
123123then
124- open " $SIGNING_CEREMONY_URL "
124+ open " $signing_ceremony_url "
125125elif which start > /dev/null
126126then
127- start " $SIGNING_CEREMONY_URL "
127+ start " $signing_ceremony_url "
128128fi
129129
130130# cleanup
0 commit comments