我最近建立了一個的DocuSign開發者賬戶和集成的密鑰,用的DocuSign REST的API玩,有一些問題澄清圍繞用戶管理的REST API的帳戶
我可以檢索下用戶的完整列表我通過使用以下REST調用帳戶。
https://demo.docusign.net/restapi/v2/accounts/<accountid>/users?additional_info=true
但是,如果我嘗試和檢索特定用戶(一個比我路過我的X-的DocuSign認證等)頭,我收到HTTP 400錯誤與在請求URI中指定的「無效的用戶ID。用戶ID信息我發送下面的頭不匹配認證用戶」
https://demo.docusign.net/restapi/v2/accounts/<accountid>/users/0d51a699-b17a-48b7-95b6-1e9e9806deb6
在這兩種情況下。
X-DocuSign-Authentication: <DocuSignCredentials><Username>{0}</Username><Password>{1}</Password><IntegratorKey>{2}</IntegratorKey></DocuSignCredentials>
我很驚訝,雖然我可以讀取所有用戶都很好,我不能只是看一個特定的用戶。當然,看起來這不是安全問題,因爲我可以通過一個API讀取用戶,但使用相同的身份驗證令牌不能訪問其他用戶。
我在想什麼?
我想我可以去SOBO(代表功能發送)的路線,但我想確認是否預期上述行爲。
更新#1
:我去了SOBO approach,現在我得到一個不同的錯誤(USER_NOT_ACCOUNT_ADMIN)如下圖所示
GET /restapi/v2/accounts/{accountid}/users/0fe29a55-5564-42a9-b09d-cbe699db13dd HTTP/1.1
Authorization: bearer {token for authenticating user}
X-DocuSign-Act-As-User: {operating user's email}
Accept: application/json
Host: demo.docusign.net
Connection: Keep-Alive
HTTP/1.1 401 Unauthorized
Cache-Control: no-cache
Content-Length: 100
Content-Type: application/json; charset=utf-8
Date: Thu, 17 Oct 2013 21:18:32 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains
{
"errorCode": "USER_NOT_ACCOUNT_ADMIN",
"message": "User is not an account administrator."
}
我也試過第二SOBO爲操作用戶獲取oauth令牌的方法,但找到http 400錯誤,並顯示以下消息
{
"error": "invalid_request",
"error_description": "An OAuth2 error occurred."
}
因此,雖然我可以獲得認證用戶的oauth令牌,但我無法爲操作用戶獲取oauth令牌或代表他們採取行動。
我已經確認身份驗證用戶是「賬戶管理員」,同時將「apiAccountWideAccess」和「•allowSendOnBehalfOf」設置爲true。唯一設置爲「false」的是「canSendAPIRequests」。我在沙箱環境中的帳戶ID是「601565a7-e9c7-463b-9d7c-622aed905ea8」有什麼想法?
更新#2
而是代表都驗證用戶和操作用戶生成的OAuth令牌,我試圖通過頁眉下方,我終於可以得到其他用戶的個人資料,並更新其他用戶的個人資料。
X-DocuSign-Authentication: <DocuSignCredentials><SendOnBehalfOf>{operating userid}</SendOnBehalfOf><Username>{authenticating userid}</Username><Password>{authenticating user's password}</Password><IntegratorKey>{developer's integrator key}</IntegratorKey></DocuSignCredentials>
太棒了! 所以這裏是什麼有效和什麼不有效的狀態。
作品沒有SOBO頭隨時隨地
GET /restapi/v2/accounts/357938/users?additional_info=true // Read all users
GET /restapi/v2/accounts/357938/[email protected]&additional_info=true // Read single user by email
POST /restapi/v2/accounts/357938/users // Add users
DELETE /restapi/v2/accounts/357938/users // Close users
* 工程與SOBO在X-的DocuSign,認證頭
PUT /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4/profile // Update user's profile
GET /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4/profile // Read user's profile
仍然不與oro一起工作UT SOBO **
GET /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4/settings
GET /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4
在這兩種不工作的情況下我得到以下錯誤
- 沒有SOBO我得到錯誤的用戶ID不匹配autheitcating用戶。
- 隨着SOBO我得到錯誤比用戶不是帳戶管理員
我將非常感謝在解決沒有工作的情況下任何幫助。我可以根據需要提供更多的細節。
其次我想實現這樣一個場景,我可以在賬戶停用用戶,使他們無法再登錄到的DocuSign。隨後,我想再次啓用該用戶,並使用與禁用之前相同的權限。
我看到用戶有一個「userStatus」字段,並想知道我是否可以使用它來取消激活用戶,然後在需要時重新激活。如果支持,那麼什麼值將對應於停用用戶?
我注意到的另一件事是,在刪除一個用戶,用戶只是軟刪除,因爲我仍然可以查詢狀態「CLOSED」的用戶。這將解決我的「停用」問題。但是我不確定在用戶「關閉」之後是否有辦法重新激活它們?
任何想法,爲什麼HTTP GET ON 「/ RESTAPI/V2 /帳號/ 357938 /用戶/ 74a021e1-3090-4843-b9ab-cceb7cd119f4/profile文件」 請求儘管在頭文件中使用了SOBO,但是成功但在GET/restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4上失敗。**嘗試創建新的集成器密鑰, admin用戶,盯着許多小時的權限和文檔,但無法弄清楚爲什麼第二個請求失敗並且第一個成功。我可以提供的唯一解釋是,可能某些帳戶設置丟失或在docusign結束有一個錯誤。任何幫助非常感謝! – somesh