1-
2-
31 /**
42 * Authorizes and makes a request to the Docusign API.
53 */
@@ -17,25 +15,25 @@ function rundocusign() {
1715 "roleName" : "role1"
1816 }
1917 ]
20- }
18+ } ;
2119 var service = getService ( ) ;
2220 if ( service . hasAccess ( ) ) {
23- var url = 'https://demo.docusign.net/restapi/v2/accounts/[INSERT- ACCOUNT-ID-HERE ]/envelopes' ;
21+ var url = 'https://demo.docusign.net/restapi/v2/accounts/[ACCOUNT-ID]/envelopes' ;
2422 var response = UrlFetchApp . fetch ( url , {
2523 headers : {
2624 Authorization : 'Bearer ' + service . getAccessToken ( )
27-
25+
2826 } ,
2927 method : 'post' ,
30- contentType : 'application/json' ,
28+ contentType : 'application/json' ,
3129 grant_type : 'authorization_code' ,
3230 payload : JSON . stringify ( payload )
33-
31+
3432 } ) ;
3533 var result = response . getContentText ( ) ;
3634 Logger . log ( result , null , 1 ) ;
3735 } else {
38-
36+
3937
4038 var authorizationUrl = service . getAuthorizationUrl ( ) ;
4139 Logger . log ( 'Open the following URL and re-run the script: %s' ,
@@ -60,8 +58,8 @@ function getService() {
6058 . setTokenUrl ( 'https://account-d.docusign.com/oauth/token' )
6159
6260 // Set the client ID and secret.
63- . setClientId ( " ..." )
64- . setClientSecret ( "..." )
61+ . setClientId ( ' ...' )
62+ . setClientSecret ( '..' )
6563
6664 // Set the name of the callback function that should be invoked to
6765 // complete the OAuth flow.
@@ -71,10 +69,7 @@ function getService() {
7169 . setPropertyStore ( PropertiesService . getUserProperties ( ) )
7270 . setScope ( 'openid' )
7371
74- // Set the response type to code (required).
75-
76-
77- }
72+ } ;
7873
7974/**
8075 * Handles the OAuth callback.
0 commit comments