php - Embedded document for Signing -Docu sign REST API -


i`m using rest api embedding signing.i want embedded document signing in website each user logged website. have created template , add tags , set them required. while creating template in 'recipients , routing' section have provided 1 signer email , name. generating url embedded signing have used following code

<?php  // input info: $email = "***";         // account email $password = "***";      // account password $integratorkey = "***";     // account integrator key, found on (preferences -> api page) $recipientname = "***";     // provide recipient (signer) name $templateid = "***";        // provide valid templateid of template in account $templaterolename = "***";  // use same role name exists on template in console $clientuserid = "***";      // add embedded recipient must set clientuserid property in addition                 // recipient name , email.  whatever set clientuserid must use same                 // value when requesting signing url  // construct authentication header: $header = "<docusigncredentials><username>" . $email . "</username><password>" . $password . "</password><integratorkey>" . $integratorkey . "</integratorkey></docusigncredentials>";  ///////////////////////////////////////////////////////////////////////////////////////////////// // step 1 - login (retrieves baseurl , 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 envelope embedded recipient (uses clientuserid property) ///////////////////////////////////////////////////////////////////////////////////////////////// $data = array("accountid" => $accountid,      "emailsubject" => "docusign api - embedded signing example",     "templateid" => $templateid,      "templateroles" => array(         array( "rolename" => $templaterolename, "email" => $email, "name" => $recipientname, "clientuserid" => $clientuserid )),     "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 --> ";     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 - embedded singing view  ///////////////////////////////////////////////////////////////////////////////////////////////// $data = array("returnurl" => "http://www.docusign.com/devcenter",     "authenticationmethod" => "none", "email" => $email,      "username" => $recipientname, "clientuserid" => $clientuserid );                                                                      $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 --> ";     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 url start embedded signing view of envelope\n";  

?>

and generate link. problem can`t see tags have set in template, , there list of fields in left side .is there additional setting display tags in documents users logged access document signing.

as follow here, looks issue due not matching recipient rolename on template. benefit of community, whenever creating envelope / requesting signature template, need make sure specify same exact rolename in api request gave template role in docusign console.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -