Get envelope URL

最后都变了- 提交于 2021-02-08 07:40:02

问题


Is there a way to use the API to get the URL for a user to view a particular envelope on the DocuSign web site? I'm not trying to use the embedded signing experience, so the various envelope "views" provided by the API are not the desired URLs. The goal is provide a link in a custom web application that when clicked would show the envelope based on the user's sign-in to the Docusign web site, redirecting to the Docusign login page if necessary (the "console" URL provides the desired UI but does not force this kind of normal website authentication).

I've seen a couple other posts, including url for managing an evelope and get document url. The latter one looked promising (though in my case the desired URL is for the overall envelope, not a specific document), but doesn't provide a code example for constructing the complete URL.

I'm using C#, with code that includes the following (based on the get envelope API):

EnvelopesApi envelopesApi = new EnvelopesApi(loginResult.ApiConfiguration);
var envelope = envelopesApi.GetEnvelope(loginResult.AccountId, envelopeId);

string envelopeUri = envelope.EnvelopeUri;

Uri baseUri;
if (Uri.TryCreate(baseUrl, UriKind.Absolute, out baseUri))
{
    var uriBuilder = new UriBuilder(baseUri.Scheme, baseUri.Host);
    uriBuilder.Path = envelopeUri;

    envelopeUrl = uriBuilder.Uri.AbsoluteUri;
}

The "baseURL" is from the login result. An example of the resulting "envelopeUrl" is https://demo.docusign.net/envelopes/c47dfe7b-3b2c-4885-95b8-56ac7c5aba18

However, that URL returns a 404 error. Is there more needed in the path portion of the URL? The documentation isn't clear how to use the returned envelopeUri, or whether it is for API use or part of a normal website URL for use in a browser.


回答1:


You mentioned that console URL provides you the desired UI so if you want console URL with normal website authentication then you can use Authorization Code Grant, https://docs.docusign.com/esign/guide/authentication/oa2_auth_code.html#starting-the-authentication-code-grant

Ask user to authenticate via DS WebApp and after authentication, you need to generate their access token using OAUTH APIs, once you get access token then use Console View to show DS WebApp to the user.




回答2:


Redirect the user to the Docusign web app

The app should prompt the user for credentials and show the envelope details page if the user has access to the envelope.

https://appdemo.docusign.com/documents/details/c47dfe7b-3b2c-4885-95b8-56ac7c5aba18



回答3:


There are a few methods of requesting a recipient view. You can obtain a console view, a sender view, or a recipient view. In your case it sounds like you want the signing view. If you supplied a ClientUserId you'll need to specify it in your request, otherwise you'll target the name / email of the recipient and make a POST call to https://{endpoint}.docusign.net/restapi/v2/accounts/$accountId/envelopes/$envelopeId/view/recipient

Example:

{ "returnUrl": "http://localhost/returnUrl", "authenticationMethod":"email", "email": "recipientemail@email.com", "userName": "RecipientName" }

This results in a response containing the in-session signing link that your recipient can use to access the envelope.

        EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.Configuration);
        RecipientViewRequest viewOptions = new RecipientViewRequest()
        {
            ReturnUrl = returnurl,
            ClientUserId = "1234",  // Must match if supplied when creating the envelope
            AuthenticationMethod = "email",
            UserName = "recipientName",
            Email = "recipientEmail"
        };


        ViewUrl recipientView = envelopesApi.CreateRecipientView(AccountId, EnvelopeId, viewOptions);


来源:https://stackoverflow.com/questions/45738785/get-envelope-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!