UpdateSession
Updates an existing signing session that is not in one of these statuses (Completed, Cancelled, Deleted, Purged, Expired, Archived) by sending a list of documents and signers to be added to the signing session. See Appendix B for a list of predefined signer roles available.
URI POST rest/v1/sessions/updatesession
Returns – A SessionResponse containing the updated Signing Session. (See SessionResponse in Appendix B)
Parameters
Name | Type | Description |
---|---|---|
encryptedToken | string | Required. Encrypted Token returned from client authentication. Returns null if token has expired or is invalid. |
username | string | Required. Username (email address) of the user who’s starting the signing session. |
session | Session | Required. See Session class in Appendix B |
Example – C#
string uri = “rest/v1/sessions/updatesession”;
string signsessionId = “GUID of existing session”;
string url = string.Empty;
string autologinUrl = landingURL + “token={0}&user={1}&ssid={2}&page={3}”;
JavaScriptSerializer jss = new JavaScriptSerializer();
List<Document> documents = new List<Document>();
SessionResponse sessionResponse;
Session sessionConfig = new Session();
sessionConfig.Id = signsessionId;
sessionConfig.SessionInfo = new SessionInfo();
sessionConfig.SessionInfo.RemoveUnassignedSignerRoles = true; // Or false.
// Use this if you want your users to be redirected in eSign 2.0 when they hit the Send button on Step2
sessionConfig.SessionInfo.SendSessionRedirectUrl = “www.mysite.com”;
Document documentConfig = new Document();
documentConfig.FileName = “Test.docx”;
documentConfig.FormId = “”; // This is the value given in the Templates configuration.
documentConfig.FormTag = “Tag2”;
documentConfig.HasAnchorTags= true; // New property telling eSign to process this document for Anchor Tags. Refer to Anchor Tags section.
documentConfig.AnchorTagsAdjustmentCategory= “predefined client specific category”; // New property telling eSign to adjust the anchor tags of this document according to predefined adjustment values mapped to this category.
documentConfig.FileBytes = File.ReadAllBytes(@”D:\doc\Test.docx”);
documents.Add(documentConfig);
sessionConfig.Documents = documents.ToArray();
Signer signer;
List<Signer> signers = new List<Signer>();
signer = new Signer();
signer.EmailAddress = “email1@docs.constellation1.com”;
signer.FirstName = “FirstName”;
signer.LastName = “LastName”;
signer.SignerRole = “Seller 1”; //(see signer roles Appendix B)
signer.AuthMethod = Authentication.KBAPlusPassword;
signer.AuthenticationSettings = new eSignAPI.AuthenticationSettings();
signer.AuthenticateSigner.Password = “password”;
// New flag to mandate a signer to upload a document before completing the session.
// You can also set this flag as part of the Properties parameter.
signer.MandateDocUpload = true;
var disableEditName = new
{
Key = “DisableEditName”,
Value = “1”
};
var properties = new[]
{
disableEditName
};
signer.Properties = properties;
// Here we’re assuming the template used has two merge fields one called “CompanyName” and the other “Job Title”. So, you supply their values this way.
signer.MergeFieldMapping = new Dictionary<string, string>() { { “CompanyName”, “RED” }, { “Job Title”, “Manager” } };
signers.Add(signer);
signer = new Signer();
signer.EmailAddress = “email2@docs.constellation1.com”;
signer.FirstName = “FirstName”;
signer.LastName = “LastName”;
signer.SignerRole = “Buyer 1”; //(see signer roles Appendix B)
signer.AuthMethod = Authentication.KBA;
signer.Properties = properties;
signers.Add(signer);
sessionConfig.Signers = signers.ToArray();
var data = new
{
userName = userName,
session = sessionConfig
};
string json = serializer.Serialize(data);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(host + uri);
request.Headers.Add(“Authorization” , encryptedToken);
request.Method = “POST”;
request.ContentType = “application/json”;
using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
{
writer.Write(json);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
sessionResponse = jss.Deserialize<RequestResponse>(responseString);
signsessionId = sessionResponse.SigningSessionId.ToString();
url = string.Format(autologinUrl, encryptedToken, user, signsessionId, “continue”);
System.Diagnostics.Process.Start(url);