|
| 1 | +# Updating Individual Permissions |
| 2 | + |
| 3 | +# Step 1: Obtain your OAuth token |
| 4 | +# Note: Substitute these values with your own |
| 5 | +# Set up variables for full code example |
| 6 | +ACCESS_TOKEN="{ACCESS_TOKEN}" |
| 7 | +API_ACCOUNT_ID="{API_ACCOUNT_ID}" |
| 8 | +PERMISSION_PROFILE_ID="{PERMISSION_PROFILE_ID}" |
| 9 | + |
| 10 | +# Check that we're in a bash shell |
| 11 | +if [[ $SHELL != *"bash"* ]]; then |
| 12 | + echo "PROBLEM: Run these scripts from within the bash shell." |
| 13 | +fi |
| 14 | +base_path="https://demo.docusign.net/restapi" |
| 15 | + |
| 16 | +# Step 2: Construct your API headers |
| 17 | +declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \ |
| 18 | + '--header' "Accept: application/json" \ |
| 19 | + '--header' "Content-Type: application/json") |
| 20 | + |
| 21 | +# Step 3: Construct the request body for your pemisison profile |
| 22 | +# Create a temporary file to store the request body |
| 23 | +request_data=$(mktemp /tmp/request-perm-001.XXXXXX) |
| 24 | +printf \ |
| 25 | +'{ |
| 26 | + "permissionProfileName": "Ipsum Reader", |
| 27 | + "settings" : { |
| 28 | + "useNewDocuSignExperienceInterface":0, |
| 29 | + "allowBulkSending":"true", |
| 30 | + "allowEnvelopeSending":"true", |
| 31 | + "allowSignerAttachments":"true", |
| 32 | + "allowTaggingInSendAndCorrect":"true", |
| 33 | + "allowWetSigningOverride":"true", |
| 34 | + "allowedAddressBookAccess":"personalAndShared", |
| 35 | + "allowedTemplateAccess":"share", |
| 36 | + "enableRecipientViewingNotifications":"true", |
| 37 | + "enableSequentialSigningInterface":"true", |
| 38 | + "receiveCompletedSelfSignedDocumentsAsEmailLinks":"false", |
| 39 | + "signingUiVersion":"v2", |
| 40 | + "useNewSendingInterface":"true", |
| 41 | + "allowApiAccess":"true", |
| 42 | + "allowApiAccessToAccount":"true", |
| 43 | + "allowApiSendingOnBehalfOfOthers":"true", |
| 44 | + "allowApiSequentialSigning":"true", |
| 45 | + "enableApiRequestLogging":"true", |
| 46 | + "allowDocuSignDesktopClient":"false", |
| 47 | + "allowSendersToSetRecipientEmailLanguage":"true", |
| 48 | + "allowVaulting":"false", |
| 49 | + "allowedToBeEnvelopeTransferRecipient":"true", |
| 50 | + "enableTransactionPointIntegration":"false", |
| 51 | + "powerFormRole":"admin", |
| 52 | + "vaultingMode":"none" |
| 53 | + } |
| 54 | +}' >> $request_data |
| 55 | + |
| 56 | +# Step 4: a) Call the eSignature API |
| 57 | +# b) Display the JSON response |
| 58 | +# Create a temporary file to store the response |
| 59 | +response=$(mktemp /tmp/response-perm.XXXXXX) |
| 60 | + |
| 61 | +Status=$(curl -w '%{http_code}' -i --request POST ${BASE_PATH}/v2.1/accounts/${API_ACCOUNT_ID}/permission_profiles/${PERMISSION_PROFILE_ID} \ |
| 62 | + "${Headers[@]}" \ |
| 63 | + --data-binary @${request_data} \ |
| 64 | + --output ${response}) |
| 65 | + |
| 66 | +# If the Status code returned is greater than 201 (OK/Accepted), display an error message along with the API response |
| 67 | +if [[ "$Status" -gt "201" ]] ; then |
| 68 | + echo "" |
| 69 | + echo "Updating Individual Permission Settings failed." |
| 70 | + echo "" |
| 71 | + cat $response |
| 72 | + exit 1 |
| 73 | +fi |
| 74 | + |
| 75 | +echo "" |
| 76 | +echo "Response:" |
| 77 | +cat $response |
| 78 | +echo "" |
| 79 | + |
| 80 | +# Remove the temporary files |
| 81 | +rm "$request_data" |
| 82 | +rm "$response" |
0 commit comments