繁体   English   中英

尝试使用REST API检索收件人视图时出现INVALID_USERID错误代码

[英]INVALID_USERID error code when trying to retrieve recipient view using REST API

我正在尝试使用REST API检索信封的收件人视图,并且在响应中收到INVALID_USERID错误代码。

请求:

POST https://demo.docusign.net/restapi/v2/accounts/<redacted>/envelopes/<redacted>/views/recipient HTTP/1.1
Authorization: bearer <redacted>
Content-Type: application/json
Host: demo.docusign.net
Content-Length: 124
Expect: 100-continue

{"authenticationMethod":"userId","clientUserId":"2","returnUrl":"<redacted>","userId":"1"}

响应:

HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-Length: 70
Content-Type: application/json; charset=utf-8
Date: Fri, 11 Apr 2014 13:48:42 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains

{
  "errorCode": "INVALID_USERID",
  "message": "Invalid UserId."
}

如您所见,我试图使用提供原始POST中发送的clientUserId和userId(因为它们是嵌入式签名者)的选项来验证收件人查看请求,而不是使用email / username方法来创建信封。 API文档没有指出要使用什么authenticationMethod值来表明我正在执行此操作。 它仅列出应将“ email”用于电子邮件/用户名方法。 因此,我正在做出最好的猜测,并使用“ userId”作为该值。

我已经验证了clientUserId和userId(来自信封请求的cipientId)与我在此处发送的内容匹配。

信封要求:

POST https://demo.docusign.net/restapi/v2/accounts/<redacted>/envelopes HTTP/1.1
Authorization: bearer <redacted>
Content-Type: multipart/form-data; boundary="AAA"
Host: demo.docusign.net
Content-Length: 309312
Expect: 100-continue
Connection: Keep-Alive

--AAA
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data

{"documents":[{"name":"EOS.pdf","documentId":"1","order":1}],"emailBlurb":null,"emailSubject":"Subject","recipients":{"signers":[{**"clientUserId":"2"**,"email":"asdf@asdf.com",**"recipientId":"1"**,"Name":"John Doe","Tabs":{"signHereTabs":[{"anchorString":"Anchor","anchorIgnoreIfNotPresent":true,"anchorUnits":null,"anchorXOffset":-10,"anchorYOffset":-15}]}}]},"status":"sent"}
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename=EOS.pdf; documentid=1

<snip>

--AAA--

我需要对请求做些什么才能使其正确提交?

根据您发布的“创建信封”请求,有效的“ POST收件人视图”请求正文(以检索URL以启动收件人的DocuSign签名会话)将为:

{
    "authenticationMethod": "Email",
    "clientUserId": "2", 
    "userName": "John Doe",
    "email": "asdf@asdf.com"
    "returnUrl": "<redacted>",
}

换句话说,您需要对在问题中发布的“ POST收件人视图”请求正文进行以下更改:

  1. 设置authenticationMethod =电子邮件
  2. 删除userId属性
  3. 添加电子邮件属性
  4. 添加userName属性

authenticationMethod指定为“ Email”仅意味着不需要高级形式的收件人身份验证(即,您不使用ID检查,电话身份验证,访问代码等,等等,等等)。

---更新(回应第一条评论)---

如果您没有使用任何高级形式的收件人身份验证(如“创建信封”请求所显示的那样),则authenticationMethod需要设置为“电子邮件”。 无论您使用userId标识收件人,还是使用电子邮件userName的组合标识收件人,都是如此。

我从来没有亲自尝试过在POST收件人视图请求中使用userId来标识收件人(我一直使用emailuserName ),但是根据文档,在POST收件人视图请求中指定userId应该是有效的(而不是电子邮件用户名 )。 但是,如果您坚持在POST收件人视图请求中使用userId来标识收件人,则需要将其设置为正确的值。 即,(从文档):

If userId is used and a clientUserId is provided, the userId must match a recipientId (which can be retrieved with a GET recipients call) for the envelope. 

在这里实现的重要一点是, 用户id在POST收件人查看请求中的值是不一样的recipientId在您创建信封请求中的值。 相反, userId的值将是一个GUID -您只能通过发出GET Recipients请求来检索它。

GET https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{envelopeId}}/recipients?include_tabs=false

此请求将返回一组收件人-根据文档,这是您需要在POST收件人视图请求中指定的receiveId属性值(作为“ userId”)。 例如,这是我的一个信封的“ GET收件人”响应:

{
    "signers": [
        {
            "name": "Bob Adams",
            "email": "bobsemail@outlook.com",
            "recipientId": "d1b33cf7-d630-4fcb-a7fb-ff6f3d946d81",
            "recipientIdGuid": "d1b33cf7-d630-4fcb-a7fb-ff6f3d946d81",
            "requireIdLookup": "false",
            "userId": "46d0615d-0ed2-4def-9918-9dc14fa82f70",
            "routingOrder": "1",
            "status": "sent"
        }
    ],
    "agents": [],
    "editors": [],
    "intermediaries": [],
    "carbonCopies": [],
    "certifiedDeliveries": [],
    "inPersonSigners": [],
    "recipientCount": "1"
}

顺便说一句-如果使用来自GET收件人响应, 用户id在POST收件人查看请求中的值recipientId的价值不工作(即使文件说,它应该),那么我可能会尝试,而不是使用的价值从GET收件人用户id响应, 用户id的在POST收件人视图请求中的值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM