DocuSignAPI嵌入式签名会话重定向url

DocuSignAPI嵌入式签名会话重定向url,docusignapi,Docusignapi,我对使用RESTAPI实现嵌入式签名相当陌生。我可以在iframe中启动签名会话,但在完成文档/模板后,它会将我重定向到url。 任何人都可以让我知道如何或在哪里配置重定向url,我猜url是附加了状态,我可以在我的应用程序中使用此令牌 别客气。。我明白了,真不敢相信我一开始就看不到 // STEP 3 - Get the Send View String reqBody = "<recipientViewRequest xmlns=\"http://www

我对使用RESTAPI实现嵌入式签名相当陌生。我可以在iframe中启动签名会话,但在完成文档/模板后,它会将我重定向到url。 任何人都可以让我知道如何或在哪里配置重定向url,我猜url是附加了状态,我可以在我的应用程序中使用此令牌

别客气。。我明白了,真不敢相信我一开始就看不到

// STEP 3 - Get the Send View           

    String reqBody = "<recipientViewRequest xmlns=\"http://www.docusign.com/restapi\">"  +
            "<authenticationMethod>email</authenticationMethod>" + 
            "<email>test@email.com</email>" + 
            **"<returnUrl>http://www.docusign.com</returnUrl>" +** 
            "<clientUserId>1</clientUserId>" + 
            "<userName>" + recipientName + "</userName>" + 
            "</recipientViewRequest>";
//步骤3-获取发送视图
字符串reqBody=“”+
“电子邮件”+
"test@email.com" + 
**"http://www.docusign.com" +** 
"1" + 
“+recipientName+”+
"";

看起来您已经回答了自己的问题,但为了社区的利益,其中一个DocuSign演示了嵌入式签名的所有步骤

下面是完整的PHP版本的代码。如您所知,您可以通过在请求正文中设置returnUrl属性来设置用户在签名后重定向到的URL

下面是用于嵌入式签名的完整PHP程序。你也可以找到这个


<?php

    // Input your info:
    $integratorKey = '...';
    $email = '...@....com';
    $password = '...';
    $name = "John Doe";

    // copy the templateId of an existing template here
    $templateId = "C9D9D181-CE57-.....................";

    // construct the authentication header:
    $header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 1 - Login (retrieves baseUrl and accountId)
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $url = "https://demo.docusign.net/restapi/v2/login_information";
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));

    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

    if ( $status != 200 ) {
        echo "error calling webservice, status is:" . $status;
        exit(-1);
    }

    $response = json_decode($json_response, true);
    $accountId = $response["loginAccounts"][0]["accountId"];
    $baseUrl = $response["loginAccounts"][0]["baseUrl"];
    curl_close($curl);

    //--- display results
    echo "accountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n";

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 2 - Create an envelope with an Embedded recipient (uses the clientUserId property)
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $data = array("accountId" => $accountId, 
        "emailSubject" => "Hello World!",
        "emailBlurb" => "This comes from PHP",
        "templateId" => $templateId, 
        "templateRoles" => array(
            array( "email" => $email, "name" => $name, "roleName" => "Signer1", "clientUserId" => "1001" )),
        "status" => "sent");                                                                    

    $data_string = json_encode($data);  
    $curl = curl_init($baseUrl . "/envelopes" );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($data_string),
        "X-DocuSign-Authentication: $header" )                                                                       
    );

    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ( $status != 201 ) {
        echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
        print_r($json_response); echo "\n";
        exit(-1);
    }

    $response = json_decode($json_response, true);
    $envelopeId = $response["envelopeId"];
    curl_close($curl);

    //--- display results   
    echo "Envelope created! Envelope ID: " . $envelopeId . "\n"; 

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 3 - Get the Embedded Singing View 
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $data = array("returnUrl" => "http://www.docusign.com/devcenter",
        "authenticationMethod" => "None", "email" => $email, 
        "userName" => $name, clientUserId => "1001"
    );                                                                    

    $data_string = json_encode($data);    
    $curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient" );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($data_string),
        "X-DocuSign-Authentication: $header" )                                                                       
    );

    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ( $status != 201 ) {
        echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
        print_r($json_response); echo "\n";
        exit(-1);
    }

    $response = json_decode($json_response, true);
    $url = $response["url"];

    //--- display results
    echo "Embedded URL is: \n\n" . $url . "\n\nNavigate to this URL to start the embedded signing view of the envelope\n"; 
?>