簡體   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