Skip to content

Commit 877d319

Browse files
committed
Configuration updates
1 parent fac3da2 commit 877d319

9 files changed

+141
-53
lines changed

examples/eg001EmbeddedSigning.sh

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ if [[ $SHELL != *"bash"* ]]; then
55
echo "PROBLEM: Run these scripts from within the bash shell."
66
fi
77

8+
# Configuration
9+
# 1. Search for and update '{USER_EMAIL}' and '{USER_FULLNAME}'.
10+
# They occur and re-occur multiple times below.
11+
# 2. Obtain an OAuth access token from
12+
# https://developers.hqtest.tst/oauth-token-generator
13+
access_token='{ACCESS_TOKEN}'
14+
# 3. Obtain your accountId from demo.docusign.com -- the account id is shown in
15+
# the drop down on the upper right corner of the screen by your picture or
16+
# the default picture.
17+
account_id='{ACCOUNT_ID}'
18+
819
#
920
# Step 1. Create the envelope.
1021
# The signer recipient includes a clientUserId setting
@@ -73,10 +84,10 @@ printf \
7384
"status": "sent"
7485
}' >> $request_data
7586

76-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
87+
curl --header "Authorization: Bearer ${access_token}" \
7788
--header "Content-Type: application/json" \
7889
--data-binary @${request_data} \
79-
--request POST ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes \
90+
--request POST ${base_path}/v2/accounts/${account_id}/envelopes \
8091
--output ${response}
8192

8293
echo ""
@@ -98,7 +109,7 @@ echo "EnvelopeId: ${envelope_id}"
98109

99110
echo ""
100111
echo "Requesting the url for the signing ceremony..."
101-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
112+
curl --header "Authorization: Bearer ${access_token}" \
102113
--header "Content-Type: application/json" \
103114
--data-binary '
104115
{
@@ -108,7 +119,7 @@ curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
108119
"userName": "{USER_FULLNAME}",
109120
"clientUserId": 1000,
110121
}' \
111-
--request POST ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes/${envelope_id}/views/recipient \
122+
--request POST ${base_path}/v2/accounts/${account_id}/envelopes/${envelope_id}/views/recipient \
112123
--output ${response}
113124

114125
echo ""
@@ -118,13 +129,14 @@ echo ""
118129

119130
signing_ceremony_url=`cat $response | grep url | sed 's/.*\"url\": \"//' | sed 's/\".*//'`
120131
echo ""
121-
echo "Attempting to automatically open your browser to the signing ceremony url..."
122-
if which open > /dev/null 2>/dev/null
123-
then
124-
open "$signing_ceremony_url"
125-
elif which start > /dev/null
126-
then
127-
start "$signing_ceremony_url"
132+
printf "The signing ceremony URL is ${signingCeremonyUrl}\n"
133+
printf "It is only valid for a couple of minutes. Attempting to automatically open your browser...\n"
134+
if which xdg-open &> /dev/null ; then
135+
xdg-open "$signingCeremonyUrl"
136+
elif which open &> /dev/null ; then
137+
open "$signingCeremonyUrl"
138+
elif which start &> /dev/null ; then
139+
start "$signingCeremonyUrl"
128140
fi
129141

130142
# cleanup

examples/eg002SigningViaEmail.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ if [[ $SHELL != *"bash"* ]]; then
66
fi
77
base_path="https://demo.docusign.net/restapi"
88

9+
# Configuration
10+
# 1. Search for and update '{USER_EMAIL}' and '{USER_FULLNAME}'.
11+
# They occur and re-occur multiple times below.
12+
# 2. Obtain an OAuth access token from
13+
# https://developers.hqtest.tst/oauth-token-generator
14+
access_token='{ACCESS_TOKEN}'
15+
# 3. Obtain your accountId from demo.docusign.com -- the account id is shown in
16+
# the drop down on the upper right corner of the screen by your picture or
17+
# the default picture.
18+
account_id='{ACCOUNT_ID}'
19+
920
# document 1 (html) has tag **signature_1**
1021
# document 2 (docx) has tag /sn1/
1122
# document 3 (pdf) has tag /sn1/
@@ -41,27 +52,24 @@ printf \
4152
"documents": [
4253
{
4354
"documentBase64": "' > $request_data
44-
cat $doc1_base64 >> $request_data
45-
printf \
46-
'",
55+
cat $doc1_base64 >> $request_data
56+
printf '",
4757
"name": "Order acknowledgement",
4858
"fileExtension": "html",
4959
"documentId": "1"
5060
},
5161
{
5262
"documentBase64": "' >> $request_data
53-
cat $doc2_base64 >> $request_data
54-
printf \
55-
'",
63+
cat $doc2_base64 >> $request_data
64+
printf '",
5665
"name": "Battle Plan",
5766
"fileExtension": "docx",
5867
"documentId": "2"
5968
},
6069
{
6170
"documentBase64": "' >> $request_data
62-
cat $doc3_base64 >> $request_data
63-
printf \
64-
'",
71+
cat $doc3_base64 >> $request_data
72+
printf '",
6573
"name": "Lorem Ipsum",
6674
"fileExtension": "pdf",
6775
"documentId": "3"
@@ -104,17 +112,17 @@ printf \
104112
"status": "sent"
105113
}' >> $request_data
106114

107-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
115+
curl --header "Authorization: Bearer ${access_token}" \
108116
--header "Content-Type: application/json" \
109117
--data-binary @${request_data} \
110-
--request POST ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes \
118+
--request POST ${base_path}/v2/accounts/${account_id}/envelopes \
111119
--output $response
112120

113121
echo ""
114122
cat $response
115123

116124
# pull out the envelopeId
117-
envelope_id=`cat $response | grep envelopeId | sed 's/.*\"envelopeId\": \"//' | sed 's/\",//' | tr -d '\r'`
125+
envelope_id=`cat $response | grep envelopeId | sed 's/.*\"envelopeId\": \"//' | sed 's/\",.*//'`
118126
# Save the envelope id for use by other scripts
119127
echo ${envelope_id} > ../ENVELOPE_ID
120128

examples/eg003ListEnvelopes.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ if [[ $SHELL != *"bash"* ]]; then
77
fi
88
base_path="https://demo.docusign.net/restapi"
99

10+
# Configuration
11+
# 1. Obtain an OAuth access token from
12+
# https://developers.hqtest.tst/oauth-token-generator
13+
access_token='{ACCESS_TOKEN}'
14+
# 2. Obtain your accountId from demo.docusign.com -- the account id is shown in
15+
# the drop down on the upper right corner of the screen by your picture or
16+
# the default picture.
17+
account_id='{ACCOUNT_ID}'
18+
1019
echo ""
1120
echo "Sending the list envelope status request to DocuSign..."
1221
echo "Results:"
@@ -16,14 +25,19 @@ echo ""
1625
# Example:
1726
# from_date=2018-09-30T07:43:12+03:00
1827
# For a Mac, 10 days in the past:
19-
from_date=`date -v -10d '+%Y-%m-%dT%H:%M:%S%z'`
20-
# Other Linux systems may be different
28+
if date -v -10d &> /dev/null ; then
29+
# Mac
30+
from_date=`date -v -10d '+%Y-%m-%dT%H:%M:%S%z'`
31+
else
32+
# Not a Mac
33+
from_date=`date --date='-10 days' '+%Y-%m-%dT%H:%M:%S%z'`
34+
fi
2135

22-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
36+
curl --header "Authorization: Bearer ${access_token}" \
2337
--header "Content-Type: application/json" \
2438
--get \
2539
--data-urlencode "from_date=${from_date}" \
26-
--request GET ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes
40+
--request GET ${base_path}/v2/accounts/${account_id}/envelopes
2741

2842
echo ""
2943
echo ""

examples/eg004EnvelopeInfo.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# The envelope_id file is created by example eg002SigningViaEmail.sh or
44
# can be manually created.
55

6+
# Configuration
7+
# 1. Obtain an OAuth access token from
8+
# https://developers.hqtest.tst/oauth-token-generator
9+
access_token='{ACCESS_TOKEN}'
10+
# 2. Obtain your accountId from demo.docusign.com -- the account id is shown in
11+
# the drop down on the upper right corner of the screen by your picture or
12+
# the default picture.
13+
account_id='{ACCOUNT_ID}'
614

715
# Check that we're in a bash shell
816
if [[ $SHELL != *"bash"* ]]; then
@@ -24,9 +32,9 @@ echo "Sending the Envelopes::get request to DocuSign..."
2432
echo "Results:"
2533
echo ""
2634

27-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
35+
curl --header "Authorization: Bearer ${access_token}" \
2836
--header "Content-Type: application/json" \
29-
--request GET ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes/${envelope_id}
37+
--request GET ${base_path}/v2/accounts/${account_id}/envelopes/${envelope_id}
3038

3139
echo ""
3240
echo ""

examples/eg005EnvelopeRecipients.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# The envelope_id file is created by example eg002SigningViaEmail.sh or
44
# can be manually created.
55

6+
# Configuration
7+
# 1. Obtain an OAuth access token from
8+
# https://developers.hqtest.tst/oauth-token-generator
9+
access_token='{ACCESS_TOKEN}'
10+
# 2. Obtain your accountId from demo.docusign.com -- the account id is shown in
11+
# the drop down on the upper right corner of the screen by your picture or
12+
# the default picture.
13+
account_id='{ACCOUNT_ID}'
614

715
# Check that we're in a bash shell
816
if [[ $SHELL != *"bash"* ]]; then
@@ -24,9 +32,9 @@ echo "Sending the EnvelopeRecipients::list request to DocuSign..."
2432
echo "Results:"
2533
echo ""
2634

27-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
35+
curl --header "Authorization: Bearer ${access_token}" \
2836
--header "Content-Type: application/json" \
29-
--request GET ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes/${envelope_id}/recipients
37+
--request GET ${base_path}/v2/accounts/${account_id}/envelopes/${envelope_id}/recipients
3038

3139
echo ""
3240
echo ""

examples/eg006EnvelopeDocs.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,38 @@
33
# The envelope_id file is created by example eg002SigningViaEmail.sh or
44
# can be manually created.
55

6+
# Configuration
7+
# 1. Obtain an OAuth access token from
8+
# https://developers.hqtest.tst/oauth-token-generator
9+
access_token='{ACCESS_TOKEN}'
10+
# 2. Obtain your accountId from demo.docusign.com -- the account id is shown in
11+
# the drop down on the upper right corner of the screen by your picture or
12+
# the default picture.
13+
account_id='{ACCOUNT_ID}'
14+
615
# Check that we're in a bash shell
716
if [[ $SHELL != *"bash"* ]]; then
817
echo "PROBLEM: Run these scripts from within the bash shell."
918
fi
1019
base_path="https://demo.docusign.net/restapi"
1120

1221
# Check that we have an envelope id
13-
if [ ! -f ../envelope_id ]; then
22+
if [ ! -f ../ENVELOPE_ID ]; then
1423
echo ""
1524
echo "PROBLEM: An envelope id is needed. Fix: execute script eg002SigningViaEmail.sh"
1625
echo ""
1726
exit -1
1827
fi
19-
envelope_id=`cat ../envelope_id`
28+
envelope_id=`cat ../ENVELOPE_ID`
2029

2130
echo ""
2231
echo "Sending the EnvelopeDocuments::list request to DocuSign..."
2332
echo "Results:"
2433
echo ""
2534

26-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
35+
curl --header "Authorization: Bearer ${access_token}" \
2736
--header "Content-Type: application/json" \
28-
--request GET ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes/${envelope_id}/documents
37+
--request GET ${base_path}/v2/accounts/${account_id}/envelopes/${envelope_id}/documents
2938

3039
echo ""
3140
echo ""

examples/eg007EnvelopeGetDoc.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
# The envelope_id file is created by example eg002SigningViaEmail.sh or
44
# can be manually created.
55

6+
# Configuration
7+
# 1. Obtain an OAuth access token from
8+
# https://developers.hqtest.tst/oauth-token-generator
9+
access_token='{ACCESS_TOKEN}'
10+
# 2. Obtain your accountId from demo.docusign.com -- the account id is shown in
11+
# the drop down on the upper right corner of the screen by your picture or
12+
# the default picture.
13+
account_id='{ACCOUNT_ID}'
14+
#
615
output_file="envelope_document."
716

817
# Check that we're in a bash shell
@@ -12,13 +21,13 @@ fi
1221
base_path="https://demo.docusign.net/restapi"
1322

1423
# Check that we have an envelope id
15-
if [ ! -f ../envelope_id ]; then
24+
if [ ! -f ../ENVELOPE_ID ]; then
1625
echo ""
1726
echo "PROBLEM: An envelope id is needed. Fix: execute script eg002SigningViaEmail.sh"
1827
echo ""
1928
exit -1
2029
fi
21-
envelope_id=`cat ../envelope_id`
30+
envelope_id=`cat ../ENVELOPE_ID`
2231

2332
doc_choice=1
2433
output_file_extension=pdf
@@ -60,9 +69,9 @@ echo ""
6069
echo "Sending the EnvelopeDocuments::get request to DocuSign..."
6170
echo ""
6271

63-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
72+
curl --header "Authorization: Bearer ${access_token}" \
6473
--header "Content-Type: application/json" \
65-
--request GET ${base_path}/v2/accounts/{ACCOUNT_ID}/envelopes/${envelope_id}/documents/${doc_choice} \
74+
--request GET ${base_path}/v2/accounts/${account_id}/envelopes/${envelope_id}/documents/${doc_choice} \
6675
--output ${output_file}${output_file_extension}
6776

6877
echo ""

examples/eg008CreateTemplate.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
# Create a template. First, the account's templates are listed.
22
# If one of the templates is named "Example Signer and CC template"
33
# then the template will not be created.
4-
#
4+
5+
# Configuration
6+
# 1. Obtain an OAuth access token from
7+
# https://developers.hqtest.tst/oauth-token-generator
8+
access_token='{ACCESS_TOKEN}'
9+
# 2. Obtain your accountId from demo.docusign.com -- the account id is shown in
10+
# the drop down on the upper right corner of the screen by your picture or
11+
# the default picture.
12+
account_id='{ACCOUNT_ID}'
13+
514
# Check that we're in a bash shell
615
if [[ $SHELL != *"bash"* ]]; then
716
echo "PROBLEM: Run these scripts from within the bash shell."
@@ -14,11 +23,11 @@ echo "Checking to see if the template already exists in your account..."
1423
echo ""
1524
template_name="Example Signer and CC template"
1625
response=$(mktemp /tmp/response-eg-008.XXXXXX)
17-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
26+
curl --header "Authorization: Bearer ${access_token}" \
1827
--header "Content-Type: application/json" \
1928
--get \
2029
--data-urlencode "search_text=${template_name}" \
21-
--request GET ${base_path}/v2/accounts/{ACCOUNT_ID}/templates \
30+
--request GET ${base_path}/v2/accounts/${account_id}/templates \
2231
--output $response
2332

2433
# pull out the templateId if it was returned
@@ -27,7 +36,7 @@ if [ "${TEMPLATE_ID}" != "" ]; then
2736
echo ""
2837
echo "Your account already includes the '${template_name}' template."
2938
# Save the template id for use by other scripts
30-
echo ${TEMPLATE_ID} > ../TEMPLATE_ID
39+
echo "${TEMPLATE_ID}" > ../TEMPLATE_ID
3140
rm "$response"
3241
echo ""
3342
echo "Done."
@@ -171,10 +180,10 @@ printf \
171180
"status": "created"
172181
}' >> $request_data
173182

174-
curl --header "Authorization: Bearer {ACCESS_TOKEN}" \
183+
curl --header "Authorization: Bearer ${access_token}" \
175184
--header "Content-Type: application/json" \
176185
--data-binary @${request_data} \
177-
--request POST ${base_path}/v2/accounts/{ACCOUNT_ID}/templates \
186+
--request POST ${base_path}/v2/accounts/${account_id}/templates \
178187
--output $response
179188

180189
echo ""

0 commit comments

Comments
 (0)