2016-09-21 31 views
0

我正在尋找一些關於如何從activti-app的給定組中檢索用戶的建議。閱讀過我試圖通過發佈包含用戶任務過濾器ID數組的JSON主體來訪問與用戶及其組相關的端點的文檔。獲取給定組的用戶Activiti Rest API

在Postman中測試此錯誤會返回500個內部服務器錯誤「異常」:「請求方法」不支持「POST」。顯然這是因爲我應該發出一個GET請求,但是我不能在這種情況下附加一個JSON體。

上述例子端點:本地主機:8080/Activiti的應用內/ API /企業/組/ {GROUP_ID} /用戶

上述文檔: https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_user_and_group_lists

具體地說本節Screencap of activti docs

任何建議將不勝感激!

謝謝!

+1

從快速查看文檔,你應該把你的過濾選項作爲'filter'的url參數不發佈JSON正文 - JSON僅用於結果 – Gagravarr

+0

@Gagravarr感謝您的建議!我嘗試將查詢參數直接附加到URL中,例如http:// localhost:8080/activiti-app/api/enterprise/admin/users?email =「[email protected]」並且還沒有運氣。我將對API文檔進行更多的調查,看看有關URL參數的功能。 –

回答

1

首先,我們必須確保我們談論的是「組織團體」而不是「能力團體」。那是我原來的困惑。一旦我創建了正確的組,我就可以成功使用REST API來獲取組列表和組列表。

由於文檔指出,要獲得組列表,這樣做:

curl [email protected] http://localhost:8080/activiti-app/api/enterprise/groups 

將返回:

{ 
    "size":2, 
    "total":2, 
    "start":0, 
    "data":[ 
     {"id":5,"name":"test-org-group-1","externalId":null,"status":"active","groups":null}, 
     {"id":6,"name":"test-org-group-2","externalId":null,"status":"active","groups":null} 
    ] 
} 

如果你想通過一個過濾器,以做「?濾波器=某些基團的名稱」。

現在,要查看特定組的成員,請傳入組ID,該ID是一個數字。所以看到測試組織組-1的成員,我會用:

curl [email protected] http://localhost:8080/activiti-app/api/enterprise/groups/5/users 

將返回:

{ 
    "size":2, 
    "total":2, 
    "start":0, 
    "data": [ 
     {"id":2,"firstName":"Test","lastName":"User1","email":"[email protected]"}, 
     {"id":3,"firstName":"Test","lastName":"User2","email":"[email protected]"} 
    ] 
} 
+0

神奇的解釋,非常感謝你的時間! –