[英]INVALID_USERID error code when trying to retrieve recipient view using REST API
I am trying to retrieve the recipient view for an envelope using the REST API, and I am getting the INVALID_USERID error code in my response. 我正在尝试使用REST API检索信封的收件人视图,并且在响应中收到INVALID_USERID错误代码。
Request: 请求:
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"}
Response: 响应:
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."
}
As you can see, I am trying to authenticate the recipient view request using the option to provide the clientUserId and userId (since they are an embedded signer) sent in original POST to create the envelope as opposed to using the email/username method. 如您所见,我试图使用提供原始POST中发送的clientUserId和userId(因为它们是嵌入式签名者)的选项来验证收件人查看请求,而不是使用email / username方法来创建信封。 The API documentation does not indicate what authenticationMethod value to use to indicate that I am doing this;
API文档没有指出要使用什么authenticationMethod值来表明我正在执行此操作。 it only lists that "email" should be used for the email/username method.
它仅列出应将“ email”用于电子邮件/用户名方法。 Therefore, I'm making my best guess and using "userId" for that value.
因此,我正在做出最好的猜测,并使用“ userId”作为该值。
I have verified that the clientUserId and userId (recipientId from the envelope request) match what I'm sending in here. 我已经验证了clientUserId和userId(来自信封请求的cipientId)与我在此处发送的内容匹配。
Envelope Request: 信封要求:
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--
Is there anything I need to do to the request to get it to submit correctly? 我需要对请求做些什么才能使其正确提交?
Based on the "Create Envelope" request that you posted, the valid "POST Recipient View" request body (to retrieve the URL to launch the recipient's DocuSign signing session) would be: 根据您发布的“创建信封”请求,有效的“ POST收件人视图”请求正文(以检索URL以启动收件人的DocuSign签名会话)将为:
{
"authenticationMethod": "Email",
"clientUserId": "2",
"userName": "John Doe",
"email": "asdf@asdf.com"
"returnUrl": "<redacted>",
}
In other words, you need to make the following changes to the "POST Recipient View" request body that you posted in your question: 换句话说,您需要对在问题中发布的“ POST收件人视图”请求正文进行以下更改:
Specifying an authenticationMethod of "Email" simply means that no advanced form of recipient authentication is required (ie, you're not using ID Check, Phone Authentication, Access Code, etc., etc., etc.). 将authenticationMethod指定为“ Email”仅意味着不需要高级形式的收件人身份验证(即,您不使用ID检查,电话身份验证,访问代码等,等等,等等)。
--- UPDATE (in response to first comment) --- ---更新(回应第一条评论)---
If you're not using any advanced form of recipient authentication (as your "Create Envelope" request shows you're not) then the authenticationMethod needs to be set to "Email". 如果您没有使用任何高级形式的收件人身份验证(如“创建信封”请求所显示的那样),则authenticationMethod需要设置为“电子邮件”。 This is true whether you use userId to identify the recipient, or a combination of email and userName to identify the recipient.
无论您使用userId标识收件人,还是使用电子邮件和userName的组合标识收件人,都是如此。
I've never personally tried using userId in the POST Recipient View request to identify the recipient (I've always used email and userName ), but according to the documentation it should be valid to specify userId in the POST Recipient View request (and not email or userName ). 我从来没有亲自尝试过在POST收件人视图请求中使用userId来标识收件人(我一直使用email和userName ),但是根据文档,在POST收件人视图请求中指定userId应该是有效的(而不是电子邮件或用户名 )。 However, if you insist on using userId in the POST Recipient View request to identify the recipient, then you need to set it to the correct value.
但是,如果您坚持在POST收件人视图请求中使用userId来标识收件人,则需要将其设置为正确的值。 ie, (from the documentation):
即,(从文档):
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.
The important thing to realize here is that the value of userId in the POST Recipient View request is NOT the same as the value of recipientId in your Create Envelope request. 在这里实现的重要一点是, 用户id在POST收件人查看请求中的值是不一样的recipientId在您创建信封请求中的值。 Instead, the value of userId will be a GUID -- one that you can only retrieve by issuing a GET Recipients request.
相反, userId的值将是一个GUID -您只能通过发出GET Recipients请求来检索它。 ie,
即
GET https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{envelopeId}}/recipients?include_tabs=false
This request will return a collection of recipients -- according to the documentation, it's the recipientId property value that you'll need to specify in your POST Recipient View request (as "userId"). 此请求将返回一组收件人-根据文档,这是您需要在POST收件人视图请求中指定的receiveId属性值(作为“ userId”)。 For example, here's a GET Recipients response for one of my envelopes:
例如,这是我的一个信封的“ 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"
}
BTW -- if using the value of recipientId from the GET Recipients response as the value of userId in the POST Recipient View request doesn't work (even though the documentation says it should), then I'd probably instead try using the value of userId from the GET Recipients response as the value of userId in the POST Recipient View request. 顺便说一句-如果使用来自GET收件人响应, 用户id在POST收件人查看请求中的值recipientId的价值不工作(即使文件说,它应该),那么我可能会尝试,而不是使用的价值从GET收件人用户id响应, 用户id的在POST收件人视图请求中的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.