首页 > 解决方案 > INVALID_REQUEST_PARAMETER DocuSign_eSign::EnvelopesApi

问题描述

尝试使用 DocuSign Ruby gem (docusign_esign (2.0.0)) 创建信封时出现以下错误。


{
  "errorCode": "UNSPECIFIED_ERROR",
  "message": "Non-static method requires a target."
}

脚步:

  1. 我使用 request_jwt_user_token 获得了访问令牌
  2. 我使用以下代码创建信封。

    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

  1. 最后将其发送给 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)

标签: docusignapi

解决方案


您可以在此处找到有效的 Ruby 代码示例。我还建议您使用DocuSign 快速入门来生成带有工作 Ruby 代码的 ZIP 文件,以防您无法让它继续工作。


推荐阅读