2013-10-16 153 views
0

REST API獲取/發佈請求問題 我想與tomcat一起使用activiti API並使用郵遞員測試我的獲取/發佈請求,但我無法獲取請求數據,像顯示所有的任務,完成一項任務等。activiti REST API獲取/發佈請求

這裏是我做過什麼

1. Put version 5.13 acitiviti-explorer.war and activiti-rest.war inside webapp in tomcat 7.0.42 
2. Startup tomcat 
3. go to http://localhost:8080/acitiviti-explorer 
4. log in as username: kermit, pw: kermit 
5. Tasks -> create a couple Tasks like 
    1. Task1 
    2. Task2 
    3. Task3 

6. Use chrome Postman - REST Client 
7. setup postman 
    - Basic Auth: username: kermit, pw: kermit 
    - Header: Content-Type, Value: application/json 

8. Input 
    URL: http://localhost:8080/activiti-rest/service/tasks 
    select: GET 

result: 
{ 
"errorMessage": "Tasks must be filtered with 'assignee', 'owner', 'involved', 'candidate'  or 'candidate-group'", 
"statusCode": 400 
} 

From the User guild under REST API 
List of tasks: GET runtime/tasks 
URL: http://localhost:8080/activiti-rest/service/runtime/tasks 
select: GET 

result: 
{ 
    "data": [ 
{ 
"id": "101", 
"url": "http://localhost:8080/activiti-rest/service/runtime/tasks/101", 
"owner": null, 
"assignee": "gonzo", 
"delegationState": null, 
"name": "enim Ut ut fugiat adipisicing in", 
"description": "Duis do Ut anim do cupidatat aute dolore nisi et reprehenderit laborum ad  Excepteur dolore", 
"createTime": "2013-10-15T19:42:17.352+0000", 
"dueDate": null, 
"priority": 50, 
"suspended": false, 
"taskDefinitionKey": null, 
"parentTaskId": null, 
"parentTaskUrl": null, 
"executionId": null, 
"executionUrl": null, 
"processInstanceId": null, 
"processInstanceUrl": null, 
"processDefinitionId": null, 
"processDefinitionUrl": null, 
"variables": [] 
}, 
{ 
"id": "103", 
"url": "http://localhost:8080/activiti-rest/service/runtime/tasks/103", 
"owner": null, 
"assignee": null, 
"delegationState": null, 
"name": "irure do adipisicing eiusmod veniam amet", 
"description": "Ut minim Lorem elit officia laborum dolore consequat pariatur enim  adipisicing adipisicing quis amet aliquip", 
"createTime": "2013-10-15T19:42:17.358+0000", 
"dueDate": null, 
"priority": 50, 
"suspended": false, 
"taskDefinitionKey": null, 
"parentTaskId": null, 
"parentTaskUrl": null, 
"executionId": null, 
"executionUrl": null, 
"processInstanceId": null, 
"processInstanceUrl": null, 
"processDefinitionId": null, 
"processDefinitionUrl": null, 
"variables": [] 
}, 
.................. 
], 
"total": 100, 
"start": 0, 
"sort": "id", 
"order": "asc", 
"size": 10 
} 

I have also tried a couple others as well but it's too long to post it all up 
but ideally I would like get back all the information about 
Task1, Task2 and Task3 using the API. Also I notice that there are total of 100 Tasks 
from Get URL: http://localhost:8080/activiti-rest/service/runtime/tasks in Postman 
where as only total of 3 tasks that we created, from 
http://localhost:8080/activiti-explorer/#database/ACT_RU_TASK or under tasks in the browser 

我們也試圖開始請假流程,並聲稱的任務,是無法從剩下的API獲得這些信息

我想知道我們是否使用了錯誤的URL或我們錯過的其他流程

在我們要使用的Ruby on鐵路作爲前端的Activiti的結束

請讓我知道,如果需要更多的信息 太感謝你了

+0

我已經使用Activiti 5.12並獲得我必須發送任何以下查詢參數'assignee'或'candidate'或'candidate-group'的任務列表。嘗試傳遞任何這些參數,看看你是否得到結果。 – Joshi

+0

我使用的Activiti 5.13,因爲他們有很多的改進,但無論如何。我也嘗試使用這個URL http:// localhost:8080/activiti-rest/service/tasks?assignee = kermit但結果是一樣的我回到了上面拉丁語中的kermit的默認任務列表,這些任務是我只是在activiti-explorer中創建的。 – AirWick219

回答

0

您正在嘗試呼錯網址:

呼叫

URL: http://localhost:8080/activiti-rest/service/runtime/tasks 
select: GET 

我已經測試過它,它工作正常。我得到所有任務的清單。

Activiti的5.13還提供了單元測試調用該URL沒有PARAMS(TaskCollectionResourceTest.testGetTasks:155

+0

如果你看第二部分,我也嘗試過。但是它給了我一個默認任務列表,總共100個,這些列表並不在我的activiti-explorer中,所有的描述都以拉丁文的形式出現。到目前爲止,我只是想玩弄他們的默認設置,並試圖在activiti-explorer中添加任務,並試圖使用我剛剛創建的任務列表 – AirWick219

+0

因爲我無法獲得我只是通過url從activiti-explorer創建的。在這一點上我不認爲單元測試會有幫助。我認爲這可能與默認的h2數據庫有關,我也在其中跟蹤[link](http://bpmn20inaction.blogspot.com/2013/02/activiti-in-action-updates-part-1 .html)解決了以前版本的數據庫問題;然而,情況並非如此 – AirWick219

+0

我相信這是與連接到activiti-explorer和activiti-ReST的默認H2數據庫不一樣的。 – AirWick219

0

我也一直在努力用類似的問題,最後的答案對我幫助很大,以便能夠利用剩下的API就像我使用錯誤的查詢URL一樣。我也有安裝郵遞員,雖然我可以看到我的Activiti的資源管理器的收件箱中,下面的查詢各種任務......

從下REST API的用戶公會任務的 列表:GET運行時間/任務

URL: http://myserver:8088/activiti-rest/service/runtime/tasks 

選擇:GET

結果:

{ 
    "data": [], 
    "total": 0, 
    "start": 0, 
    "sort": "id", 
    "order": "asc", 
    "size": 0 
} 

...好像沒有任務在那裏。也許我錯了,但據我從手冊收集,沒有必要在背景中運行一些進程,使我能夠收集其餘的查詢(我使用端口號8088而不是8080 )。