简体   繁体   English

Activiti REST API获取/发布请求

[英]activiti REST API get/post request

REST API get/post request question I am trying to work with the activiti API with tomcat and using postman to test my get/post request, but I was not able to get request the data, like show all the tasks, complete a task and other. REST API的获取/发布请求问题我正在尝试使用Tomcat与activiti API并使用邮差测试我的获取/发布请求,但是我无法获取请求的数据,例如显示所有任务,完成任务和其他。

Here is what I did 这是我所做的

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

We have also tried to start a Vacation Request process and claimed the tasks and was not able to get those information from the rest API 我们还尝试启动了“休假请求”流程并声明了任务,但无法从其余API获取这些信息

I was wondering if we have used the wrong URL or other processes that we have missed 我想知道我们是否使用了错误的URL或错过的其他流程

At the end we want to use Ruby on rail as a front end for the activiti 最后,我们要使用Ruby on rail作为活动的前端

Please let me know if additional information is needed thank you so much 请让我知道是否需要其他信息非常感谢

You are trying to call wrong URL: 您正在尝试调用错误的URL:

Call 呼叫

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

I have tested it and it works fine. 我已经对其进行了测试,并且效果很好。 I get list of all tasks. 我得到所有任务的清单。

Activiti 5.13 also provides a unit-test that calls that URL without params ( TaskCollectionResourceTest.testGetTasks:155 ) Activiti 5.13还提供了一个单元测试,该调用无需参数TaskCollectionResourceTest.testGetTasks:155调用该URL( TaskCollectionResourceTest.testGetTasks:155

I too have been struggling with a similar problem, and the last answer helped me a lot to be able to make use of the rest API bevause I likewise was using the wrong query URLs. 我也一直在努力解决类似的问题,由于我同样使用了错误的查询URL,所以最后一个答案对我有很大帮助,使我能够充分利用其余的API。 I also have postman installed and although I can see various tasks in my activiti-explorer inbox, the following query... 我还安装了邮递员,尽管我可以在activiti-explorer收件箱中看到各种任务,但以下查询...

From the User guild under REST API List of tasks: GET runtime/tasks 从REST API下的用户行会任务列表:GET运行时/任务

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

select: GET 选择:获取

results in: 结果是:

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

...as if there were no tasks there. ...好像那里没有任务。 Maybe I got something wrong, but as far as I gleaned from the manual, it is not necessary that some process be running in the backgound to enable me to gather them with the rest query (I use the port number 8088 in the stead of 8080). 也许我弄错了,但是就我从手册中收集的信息而言,没有必要在后台运行某些进程以使我能够与其余查询一起收集它们(我使用端口号8088代替了8080 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM