2013-10-16 108 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 )。