我正在尝试将docusign签名页嵌入到网站中。但我得到了这个错误
Message=Error calling CreateRecipientView: {
"errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient of
the specified envelope."
}
我正在使用。Net nuget客户端,下面是我使用的代码(注意,我更改了GUID和电子邮件)
证明…是真实的
string userId = "0570b3da-652e-4040-842e-65a0e6fc8133"; // use your userId (guid), not email address
string integratorKey = "cf73e7bb-e05d-4ce9-9cea-ac065dc894ac";
string host = "https://demo.docusign.net/restapi";
ApiClient apiClient = new ApiClient(host);
string username = "my@email.com";
string password = "[password]";
// initialize client for desired environment (for production change to www)
Configuration.Default.ApiClient = apiClient;
// configure 'X-DocuSign-Authentication' header
string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}";
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
查找帐户id
这是
example code
// we will retrieve this from the login API call
string accountId = null;
AuthenticationApi authApi = new AuthenticationApi(apiClient.Configuration);
LoginInformation loginInfo = authApi.Login();
//find the default account for this user
foreach (LoginAccount loginAcct in loginInfo.LoginAccounts)
{
if (loginAcct.IsDefault == "true")
{
accountId = loginAcct.AccountId;
string[] separatingStrings = { "/v2" };
// Update ApiClient with the new base url from login call
apiClient = new ApiClient(loginAcct.BaseUrl.Split(separatingStrings, StringSplitOptions.RemoveEmptyEntries)[0]);
break;
}
}
从模板创建信封
EnvelopeDefinition envDef = new EnvelopeDefinition();
TemplateRole tRole = new TemplateRole();
tRole.Email = "recipient@email.com";
tRole.RoleName = "Leaseholder";
tRole.ClientUserId = tRole.Email;
List<TemplateRole> rolesList = new List<TemplateRole> { tRole };
envDef.TemplateRoles = rolesList;
envDef.TemplateId = "2504e3f0-f4d9-4eca-9fd3-3b26cfd6c086";
RecipientViewRequest viewOptions = new RecipientViewRequest()
{
ReturnUrl = "http://localhost:64202/home/winning",
ClientUserId = tRole.Email, // must match clientUserId of the embedded recipient
AuthenticationMethod = "email",
UserName = tRole.Email,
Email = tRole.Email
};
EnvelopesApi envelopesApi = new EnvelopesApi();
var summary = envelopesApi.CreateEnvelope(accountId, envDef);
var receipients = envelopesApi.ListRecipients(accountId, summary.EnvelopeId);
ViewUrl viewUrl = envelopesApi.CreateRecipientView(accountId, summary.EnvelopeId, viewOptions);
return Content($"<h2>hmm</h2><iframe width=\"100%\" height=\"100%\" src=\"{viewUrl.Url}\"/>");
模板上的收件人
收件人
{
"agents": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"editors": [],
"inPersonSigners": [],
"intermediaries": [],
"recipientCount": "1",
"seals": [],
"signers": [
{
"clientUserId": "recipient@email.com",
"creationReason": "sender",
"deliveryMethod": "email",
"email": "recipient@email.com",
"isBulkRecipient": "false",
"name": "",
"note": "",
"recipientId": "1",
"recipientIdGuid": "52abdeea-2bd6-4108-97b9-170ca27d573a",
"requireIdLookup": "false",
"roleName": "Leaseholder",
"routingOrder": "1",
"status": "created",
"userId": "0570b3da-652e-4040-842e-65a0e6fc8133"
}
]
}