调用DocuSign envelopesApi.createRecipientView()持续返回400错误求助
DocuSign createRecipientView() 400 Bad Request 错误排查
问题场景
调用DocuSign的envelopesApi.createRecipientView()时持续返回400 Bad Request错误,相关代码、配置及签署人信息如下:
调用代码
let viewRequest = new docuSign.RecipientViewRequest(); viewRequest.returnUrl = this.returnUrl; viewRequest.authenticationMethod = "none"; viewRequest.email = signerEmail; viewRequest.userName = signerName; viewRequest.clientUserId = this.clientUserId; //? viewRequest.pingFrequency = 600; console.log("view request", viewRequest); console.log("accountInfo.apiAccountId", accountInfo.apiAccountId); console.log("envelopeId", envelopeId); result = await envelopesApi.createRecipientView( accountInfo.apiAccountId, envelopeId, { recipientViewRequest: viewRequest, } );
参数配置
returnUrl="www.google.com" clientUserId=1; signerEmail = "tranleha1710@gmail.com"; signerName = "tran le ha";
信封签署人信息
let signer = docuSign.Signer.constructFromObject({ email: envelopeArgs.signerEmail, name: envelopeArgs.signerName, recipientId: "1", clientUserId: this.clientUserId, });
注:创建信封与调用接口使用的apiAccountId一致,采用JWT授权认证。
排查方向
- 修正Return URL格式:当前
returnUrl缺少http/https协议头,DocuSign要求必须是完整的有效URL,需改为https://www.google.com。 - 统一ClientUserId类型:
clientUserId需为字符串类型,当前设置为数字1,需修改为字符串"1",确保RecipientViewRequest和Signer对象中的该字段类型完全一致。 - 验证AuthenticationMethod配置:若账号强制要求收件人认证,
authenticationMethod: "none"可能不被允许,可尝试改为"email"或"password"(需匹配账号配置)。 - 核对签署人信息一致性:确保RecipientViewRequest中的
email、userName、clientUserId与信封中Signer对象的对应字段完全匹配(包括大小写、空格)。 - 检查信封状态:调用
createRecipientView时,信封必须处于sent状态,可通过envelopesApi.getEnvelope()接口确认信封status字段。 - 确认JWT用户权限:JWT授权的用户需为信封创建者或拥有Envelope Sender及以上权限,确保该用户能访问目标信封。
内容的提问来源于stack exchange,提问作者Ngọc Trung Nguyễn
相关产品推荐
相关产品推荐

