通过DocuSign API获取无效的用户权限

时间:2014-07-14 08:35:14

标签: docusignapi

我正在尝试使用DocuSign API和我的主帐户代表子用户发送,但我收到以下错误消息:

HTTP/1.1 401 Unauthorized
Cache-Control: no-cache
Content-Length: 126
Content-Type: application/json; charset=utf-8
Date: Mon, 14 Jul 2014 08:00:13 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains

{
  "errorCode": "USER_LACKS_PERMISSIONS",
  "message": "This user lacks sufficient permissions to access this resource."
}

我使用的代码是:

POST https://demo.docusign.net/restapi/v2/accounts/651932/envelopes HTTP/1.1
Content-Type: multipart/form-data; boundary=COMPANYBOUNDARY
Accept: application/json
Authorization: bearer ijj3DH7YYT4MH9mDh7HO/AYCltk=
X-DocuSign-Act-As-User: joffrey@company.com
Host: demo.docusign.net
Content-Length: 13047
Expect: 100-continue
Connection: Keep-Alive

--COMPANYBOUNDARY
Content-Type: application/json
Content-Disposition: form-data

{"Status":"sent","emailBlurb":"Test e-mail body","emailSubject":"asd","documents":[{"name":"Test Document with ID.docx","documentId":1,"order":1}],"recipients":{"signers":[{"email":"anycustomer@gmail.com","name":"Dave","recipientId":0,"tabs":{"signHereTabs":[{"anchorString":"/customer/","anchorIgnoreIfNotPresent":false}]}}]}}
--COMPANYBOUNDARY
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: file; filename="Test Document with ID.docx"; documentid="1"

*byteshere*
--COMPANYBOUNDARY—

我们尝试使用子用户连接到在线控制台并成功发送信封,因此正确设置了发送信封的权限。

主帐户也已“代表发送”权限设置为true:

permissions

如何解决这个问题的任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

经过进一步测试后,我确认当授权令牌属于该用户时,无需在X-DocuSign-Act-As-User标头中识别操作用户。当用户缺少SOBO权限时这样做会导致401错误,即使X-DocuSign-Act-As-User设置为同一用户。