Skip to main content

I’m writing an integration that will need to email the same document to hundreds of different people to sign.  The application should run with no user intervention, so I’m using a JWT Grant and have setup a template for my document to be signed.  My code can successfully use the JWT grant to get a Bearer token.  But, when I use the Bearer token to call the eSignature API for sending an envelope, I get an HTML page back.  I do not get a document set to the signer.  I’m getting some type of error, but the returned HTML is no help on what the error is.
 

URL I’m calling: https://account-d.docusign.com/v2.1/accounts/<my account id>/envelopes

POST body:

{
  "templateId": "dd5bb40b-2801-4434-babe-1e01eccc8ded",
  "templateRoles": "
    {
      "name": "Eric Calvert",
      "email": "xxxxxxxxxx@xxxxx.com",
      "roleName": "signer"
    }
  ],
  "status": "sent"
}

Code snippet (golang):

 

    req.Header.Set("Content-Type", "application/json")

    req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))

    req.Header.Set("Accept", "application/json")

    resp, e := http.DefaultClient.Do(req)

    if e != nil {

        return fmt.Errorf("http error: %s", e.Error())

    }

 

Returned HTML:

 

<!DOCTYPE html>

<html lang="en" class="account-server">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0">
    <title>Docusign</title>
        <link rel="icon" href="https://docucdn-a.akamaihd.net/olive/images/2.64.0/global-assets/ds-icons-favicon-defa                                                                        ult-64x64.svg" type="image/svg+xml">
    <link rel="canonical" href="https://account-d.docusign.com/" />
    <base href="/">

    <script type="text/javascript" nonce="MgGVdMvJN/5iUFyapGzPFQUR58AgZ2q9q8VWI37Okaw=">
             window.__KAZMON_CONFIG__ = {
                 buildVersion: "25.2.100.26629",
                 environment: "DEMO",
                 instrumentationKey: "88d193ed-7206-4e34-975a-193a4fd08e36"
             };


        window.__NEW_ROOT_API__ = "True";
        var FixtureHelper = {};
    </script>

    <!-- 25.2.100.26629 DA1DFE179 f2d68b35-f084-482d-b2fe-a6a2736351cb -->
</head>
<body class="site-content">
    <noscript>You need to enable JavaScript to run this app.</noscript>

    <div id="root"></div>

    <form name="fixtureForm">
            <input id="fixtureInput" type="hidden" value="{&quot;settings&amp;quot;:{&amp;quot;traceToken&amp;quo                                                                        t;:&amp;quot;f2d68b35-f084-482d-b2fe-a6a2736351cb&amp;quot;,&amp;quot;siteRoot&amp;quot;:&amp;quot;https://account-d.                                                                        docusign.com/&amp;quot;,&amp;quot;forgotPasswordUri&amp;quot;:&amp;quot;https://account-d.docusign.com/forgotpassword                                                                        &amp;quot;,&amp;quot;flowSubmissionUris&amp;quot;:{&amp;quot;oAuth&amp;quot;:&amp;quot;/oauth/auth&amp;quot;,&amp;quo                                                                        t;sso&amp;quot;:&amp;quot;/saml2/login/sp&amp;quot;,&amp;quot;username&amp;quot;:&amp;quot;/username&amp;quot;,&amp;q                                                                        uot;password&amp;quot;:&amp;quot;/password&amp;quot;,&amp;quot;web&amp;quot;:&amp;quot;/web/login&amp;quot;,&amp;quot                                                                        ;signUp&amp;quot;:&amp;quot;/signup&amp;quot;,&amp;quot;securityKeyLogin&amp;quot;:&amp;quot;/securitykeylogin&amp;qu                                                                        ot;,&amp;quot;resourceCredentialSecurityKeyCreation&amp;quot;:&amp;quot;/resources/v1/manage/security-key/create&amp;                                                                        quot;,&amp;quot;resourceCredentialSecurityKeyLogin&amp;quot;:&amp;quot;/resources/v1/manage/security-key/login&amp;qu                                                                        ot;},&amp;quot;allowGetBrowserFingerprint&amp;quot;:true,&amp;quot;renderInkLoginApp&amp;quot;:true,&amp;quot;assetPr                                                                        eloaderUrl&amp;quot;:null,&amp;quot;pseudoLocalizationEnabled&amp;quot;:false,&amp;quot;rebrandingEnabled&amp;quot;:t                                                                        rue},&amp;quot;stateData&amp;quot;:{&amp;quot;state&amp;quot;:&amp;quot;username&amp;quot;,&amp;quot;oAuthLoginHintQS                                                                        &amp;quot;:null,&amp;quot;oAuthLoginHintCookie&amp;quot;:null,&amp;quot;usernamePostAction&amp;quot;:null,&amp;quot;l                                                                        ogoBytes&amp;quot;:null,&amp;quot;data&amp;quot;:null},&amp;quot;error&amp;quot;:null}" />
        <input name="__RequestVerificationToken" type="hidden" value="ASckkgrUhwnObJqO-sO9gecAAAAA0" />
    </form>
</body>
<script src="/ReactApp/src/vendor/html-domparser.js"></script>
<script src="/ReactApp/dist/bundle.js?version=25.2.100.26629"></script>

</html>

Be the first to reply!

Reply