Skip to content

Commit

Permalink
Syncing latest README and Code Examples
Browse files Browse the repository at this point in the history
Syncing latest README and Code Examples
  • Loading branch information
MattKingDS committed Mar 17, 2020
1 parent a8ad9a6 commit 7625f1e
Show file tree
Hide file tree
Showing 9 changed files with 825 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,30 @@ This repo includes bash scripts that use curl to demonstrate:
1. **Send an envelope with a remote (email) signer using Identity Verification.**
[Source.](./examples/eg023SigningViaEmailWithIDVAuthentication.sh)
This example sends an envelope using remote (email) signing requiring the recipient to validate their identity via a government issued ID.
1. **Create a permissions profile to set against a user group.**
[Source.](./examples/eg024CreatingPermissionProfiles.sh)
This example creates a permissions profile that can be used to set account permissions for the different user groups associated with your account.
1. **Set a permissions profile against a user group.**
[Source.](./examples/eg025SettingPermissionProfiles.sh)
This example updates a user group by setting the permissions profile.
1. **Update individual settings on a permissions profile.**
[Source.](./examples/eg026UpdatingIndividualPermission.sh)
This example updates a user group by setting the permissions profile.
1. **Delete a permissions profile**
[Source.](./examples/eg027DeletingPermissions.sh)
This example deletes a permissions profile.
1. **Creating a brand**
[Source.](./examples/eg028CreatingABrand.sh)
This example creates a brand on your account that can be used to override style elements on envelopes.
1. **Apply a brand to an envelope**
[Source.](./examples/eg029ApplyingBrandEnvelope.sh)
This example sends a branded envelope.
1. **Apply a brand to a template**
[Source.](./examples/eg030ApplyingBrandTemplate.sh)
This example sends a branded templated envelope.
1. **Sending bulk envelopes to multiple recipients**
[Source.](./examples/eg031BulkSending.sh)
This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send.

## Installation

Expand Down Expand Up @@ -148,6 +172,15 @@ bash eg020SigningViaEmailWithSmsAuthentication.sh
bash eg021SigningViaEmailWithPhoneAuthentication.sh
bash eg022SigningViaEmailWithKnoweldgeBasedAuthentication.sh
bash eg023SigningViaEmailWithIDVAuthentication.sh
bash eg024CreatingPermissionProfiles.sh
bash eg025SettingPermissionProfiles.sh
bash eg026UpdatingIndividualPermission.sh
bash eg027DeletingPermissions.sh
bash eg028CreatingABrand.sh
bash eg029ApplyingBrandEnvelope.sh
bash eg030ApplyingBrandTemplate.sh
bash eg031BulkSending.sh
# Note: to use example 14 you must also configure a
# payment gateway for your account.
Expand Down
81 changes: 81 additions & 0 deletions examples/eg024CreatingPermissionProfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Create Permission Profile

# Step 1: Obtain your OAuth token
# Note: Substitute these values with your own
# Set up variables for full code example
ACCESS_TOKEN="{ACCESS_TOKEN}"
API_ACCOUNT_ID="{ACCOUNT_ID}"

# Check that we're in a bash shell
if [[ $SHELL != *"bash"* ]]; then
echo "PROBLEM: Run these scripts from within the bash shell."
fi
BASE_PATH="https://demo.docusign.net/restapi"

# Step 2: Construct your API headers
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

# Step 3: Construct the request body for your pemisison profile
# Create a temporary file to store the request body
request_data=$(mktemp /tmp/request-perm-001.XXXXXX)
printf \
'{
"permissionProfileName": "Ipsum Reader",
"settings" : {
"useNewDocuSignExperienceInterface":0,
"allowBulkSending":"true",
"allowEnvelopeSending":"true",
"allowSignerAttachments":"true",
"allowTaggingInSendAndCorrect":"true",
"allowWetSigningOverride":"true",
"allowedAddressBookAccess":"personalAndShared",
"allowedTemplateAccess":"share",
"enableRecipientViewingNotifications":"true",
"enableSequentialSigningInterface":"true",
"receiveCompletedSelfSignedDocumentsAsEmailLinks":"false",
"signingUiVersion":"v2",
"useNewSendingInterface":"true",
"allowApiAccess":"true",
"allowApiAccessToAccount":"true",
"allowApiSendingOnBehalfOfOthers":"true",
"allowApiSequentialSigning":"true",
"enableApiRequestLogging":"true",
"allowDocuSignDesktopClient":"false",
"allowSendersToSetRecipientEmailLanguage":"true",
"allowVaulting":"false",
"allowedToBeEnvelopeTransferRecipient":"true",
"enableTransactionPointIntegration":"false",
"powerFormRole":"admin",
"vaultingMode":"none"
}
}' >> $request_data

# Step 4: a) Call the eSignature API
# b) Display the JSON response
# Create a temporary file to store the response
response=$(mktemp /tmp/response-perm.XXXXXX)

Status=$(curl -w '%{http_code}' -i --request POST ${BASE_PATH}/v2.1/accounts/${API_ACCOUNT_ID}/permission_profiles \
"${Headers[@]}" \
--data-binary @${request_data} \
--output ${response})

# If the Status code returned is greater than 201 (OK/Accepted), display an error message along with the API response
if [[ "$Status" -gt "201" ]] ; then
echo ""
echo "Unable to create a new permissions profile."
echo ""
cat $response
exit 1
fi

echo ""
echo "Response:"
cat $response
echo ""

# Remove the temporary files
rm "$request_data"
rm "$response"
62 changes: 62 additions & 0 deletions examples/eg025SettingPermissionProfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Setting a permission profile

# Step 1: Obtain your OAuth token
# Set up variables for full code example
# Note: Substitute these values with your own
ACCESS_TOKEN="{ACCESS_TOKEN}"
API_ACCOUNT_ID="{API_ACCOUNT_ID}"
PROFILE_ID="{PROFILE_ID}"
GROUP_ID="{GROUP_ID}"


# Check that we're in a bash shell
if [[ $SHELL != *"bash"* ]]; then
echo "PROBLEM: Run these scripts from within the bash shell."
fi
BASE_PATH="https://demo.docusign.net/restapi"

# Step 2: Construct your API headers
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

# Step 3: Construct your request body
# Create a temporary file to store the request body
request_data=$(mktemp /tmp/request-perm-001.XXXXXX)
printf \
"{
\"groups\": [
{
\"groupId\": "${GROUP_ID}",
\"permissionProfileId\": "${PROFILE_ID}"
}
]
}}" >> $request_data

# Step 4: a) Call the eSignature API
# b) Display the JSON response
# Create a temporary file to store the response
response=$(mktemp /tmp/response-perm.XXXXXX)

Status=$(curl -w '%{http_code}' -i --request PUT ${BASE_PATH}/v2.1/accounts/${API_ACCOUNT_ID}/groups \
"${Headers[@]}" \
--data-binary @${request_data} \
--output ${response})

# If the Status code returned is greater than 201 (OK/Accepted), display an error message along with the API response
if [[ "$Status" -gt "201" ]] ; then
echo ""
echo "Unable to set group permissions profile."
echo ""
cat $response
exit 1
fi

echo ""
echo "Response:"
cat $response
echo ""

# Remove the temporary files
rm "$request_data"
rm "$response"
82 changes: 82 additions & 0 deletions examples/eg026UpdatingIndividualPermission.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Updating Individual Permissions

# Step 1: Obtain your OAuth token
# Note: Substitute these values with your own
# Set up variables for full code example
ACCESS_TOKEN="{ACCESS_TOKEN}"
API_ACCOUNT_ID="{API_ACCOUNT_ID}"
PERMISSION_PROFILE_ID="{PERMISSION_PROFILE_ID}"

# Check that we're in a bash shell
if [[ $SHELL != *"bash"* ]]; then
echo "PROBLEM: Run these scripts from within the bash shell."
fi
base_path="https://demo.docusign.net/restapi"

# Step 2: Construct your API headers
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

# Step 3: Construct the request body for your pemisison profile
# Create a temporary file to store the request body
request_data=$(mktemp /tmp/request-perm-001.XXXXXX)
printf \
'{
"permissionProfileName": "Ipsum Reader",
"settings" : {
"useNewDocuSignExperienceInterface":0,
"allowBulkSending":"true",
"allowEnvelopeSending":"true",
"allowSignerAttachments":"true",
"allowTaggingInSendAndCorrect":"true",
"allowWetSigningOverride":"true",
"allowedAddressBookAccess":"personalAndShared",
"allowedTemplateAccess":"share",
"enableRecipientViewingNotifications":"true",
"enableSequentialSigningInterface":"true",
"receiveCompletedSelfSignedDocumentsAsEmailLinks":"false",
"signingUiVersion":"v2",
"useNewSendingInterface":"true",
"allowApiAccess":"true",
"allowApiAccessToAccount":"true",
"allowApiSendingOnBehalfOfOthers":"true",
"allowApiSequentialSigning":"true",
"enableApiRequestLogging":"true",
"allowDocuSignDesktopClient":"false",
"allowSendersToSetRecipientEmailLanguage":"true",
"allowVaulting":"false",
"allowedToBeEnvelopeTransferRecipient":"true",
"enableTransactionPointIntegration":"false",
"powerFormRole":"admin",
"vaultingMode":"none"
}
}' >> $request_data

# Step 4: a) Call the eSignature API
# b) Display the JSON response
# Create a temporary file to store the response
response=$(mktemp /tmp/response-perm.XXXXXX)

Status=$(curl -w '%{http_code}' -i --request POST ${BASE_PATH}/v2.1/accounts/${API_ACCOUNT_ID}/permission_profiles/${PERMISSION_PROFILE_ID} \
"${Headers[@]}" \
--data-binary @${request_data} \
--output ${response})

# If the Status code returned is greater than 201 (OK/Accepted), display an error message along with the API response
if [[ "$Status" -gt "201" ]] ; then
echo ""
echo "Updating Individual Permission Settings failed."
echo ""
cat $response
exit 1
fi

echo ""
echo "Response:"
cat $response
echo ""

# Remove the temporary files
rm "$request_data"
rm "$response"
46 changes: 46 additions & 0 deletions examples/eg027DeletingPermissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Delete a permission profile

# Step 1: Obtain your OAuth token
# Note: Substitute these values with your own
# Set up variables for full code example
ACCESS_TOKEN="{ACCESS_TOKEN}"
API_ACCOUNT_ID="{ACCOUNT_ID}"
PROFILE_ID="{PROFILE_ID]"

# Check that we're in a bash shell
if [[ $SHELL != *"bash"* ]]; then
echo "PROBLEM: Run these scripts from within the bash shell."
fi
BASE_PATH="https://demo.docusign.net/restapi"

#Step 2: Construct your API headers
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

# Step 3: a) Call the eSignature API
# b) Display the JSON response
# Create a temporary file to store the response
response=$(mktemp /tmp/response-perm.XXXXXX)

Status=$(curl -w '%{http_code}' -i --request DELETE ${BASE_PATH}/v2.1/accounts/${APIAccountID}/permission_profiles/${PROFILE_ID} \
"${Headers[@]}" \
--output ${response})

# If the Status code returned is greater than 201 (OK/Accepted), display an error message along with the API response
if [[ "$Status" -gt "201" ]] ; then
echo ""
echo "Unable to delete the permission profile."
echo ""
cat $response
exit 1
fi

echo ""
echo "Response:"
cat $response
echo ""

# Remove the temporary files
rm "$request_data"
rm "$response"
57 changes: 57 additions & 0 deletions examples/eg028CreatingABrand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Creating a brand

# Step 1: Obtain your OAuth token
# Note: Substitute these values with your own
# Set up variables for full code example
ACCESS_TOKEN="{ACCESS_TOKEN}"
API_ACCOUNT_ID="{API_ACCOUNT_ID}"

# Check that we're in a bash shell
if [[ $SHELL != *"bash"* ]]; then
echo "PROBLEM: Run these scripts from within the bash shell."
fi
BASE_PATH="https://demo.docusign.net/restapi"

# Step 2: Construct your API headers
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

# Step 3: Construct the request body
# Create a temporary file to store the request body
request_data=$(mktemp /tmp/request-brand-001.XXXXXX)
printf \
'{
"brandName": "Sample Corp.",
"defaultBrandLanguage": "en"
}' >> $request_data

# Step 4: a) Call the eSignature API
# b) Display the JSON response
# Create a temporary file to store the response
response=$(mktemp /tmp/response-brand.XXXXXX)

Status=$(curl -w '%{http_code}' -i --request POST ${BASE_PATH}/v2.1/accounts/${API_ACCOUNT_ID}/brands \
"${Headers[@]}" \
--data-binary @${request_data} \
--output ${response})

# If the Status code returned is greater than 201 (OK/Accepted), display an error message along with the API response
if [[ "$Status" -gt "201" ]] ; then
echo ""
echo "Creating a new brand has failed."
echo ""
cat $response
exit 1
fi

echo ""
echo "Response:"
cat $response
echo ""

# Remove the temporary files
rm "$request_data"
rm "$response"
Loading

0 comments on commit 7625f1e

Please sign in to comment.