docusignapi - INVALID_REQUEST_PARAMETER DocuSign_eSign::EnvelopesApi
问题描述
尝试使用 DocuSign Ruby gem (docusign_esign (2.0.0)) 创建信封时出现以下错误。
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "Non-static method requires a target."
}
脚步:
- 我使用 request_jwt_user_token 获得了访问令牌
- 我使用以下代码创建信封。
def create_envelope(signer, filename)
envelope_definition = DocuSign_eSign::EnvelopeDefinition.new({
status: 'sent',
templateId: 'xxxx-xxx-xxx-a598-f49efba2e72f',
})
signer = DocuSign_eSign::TemplateRole.new({
email: signer[:email],
name: signer[:name],
roleName: 'signer',
})
cc = DocuSign_eSign::TemplateRole.new({
email: 'xxx@xxxx.com',
name: 'xxxx',
roleName: 'cc',
})
envelope_definition.template_roles = [signer, cc]
envelope_definition
end
- 最后将其发送给 DocuSign。基本路径为
'https://demo.docusign.net/restapi'
。如前所述,envelopes_resp 是给我400
错误的原因。
base_path = 'https://demo.docusign.net/restapi'
envelope = create_envelope.call(signer, filename)
configuration = DocuSign_eSign::Configuration.new
configuration.host = base_path
api_client = DocuSign_eSign::ApiClient.new configuration
api_client.default_headers['Authorization'] = "Bearer #{auth_resp.access_token}"
envelopes_api = DocuSign_eSign::EnvelopesApi.new api_client
envelopes_resp = envelopes_api.create_envelope(config[:account_id], envelope)
解决方案
您可以在此处找到有效的 Ruby 代码示例。我还建议您使用DocuSign 快速入门来生成带有工作 Ruby 代码的 ZIP 文件,以防您无法让它继续工作。
推荐阅读
- r - 如何在绘图模式栏中添加搜索按钮?
- oracle - 如何将地理空间数据从本地 Oracle 移动到 Azure Storage Gen2 - 数据工厂不支持?
- reactjs - "需要一个项目列表,但输入的是 \"dict\"。",
- python - 验证所有 Pipenv 软件包都已安装并且是最新的,而无需卸载并重新安装整个虚拟环境“pipenv install”
- python - 带有网页抓取的提要数据框
- command-line-interface - pytest 命令行调用会用省略号截断输出,即使使用调试标志也是如此
- javascript - 表 td 循环中的 jQuery 计算
- javascript - 使用键盘上的箭头移动幻灯片
- python - 从给定的数据帧返回一个排序的数据帧
- rest - 如何对查看静止资源的行为进行建模