New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The API subtasks return a different response compared to the standard #1893

Closed
mauriziovitale opened this Issue May 9, 2018 · 5 comments

Comments

5 participants
@mauriziovitale
Copy link

mauriziovitale commented May 9, 2018

The api
http://{{domain}}/rb-my-app/v1/tasks/5f716c0b-5383-11e8-ab55-0a5864600352/subtasks
returns

{
    "links": [
        {
            ...
        }
    ],
    "content": [
        {
            "id": "ef2c3e4c-5385-11e8-ab55-0a5864600352",
            "assignee": "hruser",
            "createdDate": 1525869534321,
            "priority": 50,
            "parentTaskId": "5f716c0b-5383-11e8-ab55-0a5864600352",
            "status": "ASSIGNED"
       },
       {
            "id": "5c2cd61d-5388-11e8-ab55-0a5864600352",
            "assignee": "hruser",
            "createdDate": 1525870576190,
            "priority": 50,
            "parentTaskId": "5f716c0b-5383-11e8-ab55-0a5864600352",
            "status": "ASSIGNED"
       }]
}

I was expecting to have something like the getTasks API

{
    "list": {
        "entries": [
            {
                "entry": {
                    "id": "397f2d88-5382-11e8-ab55-0a5864600352",
                    "assignee": "hruser",
                    "createdDate": 1525867941029,
                    "priority": 50,
                    "status": "ASSIGNED"
                }
            },
            {
                "entry": {
                    "id": "4d4dde09-5383-11e8-ab55-0a5864600352",
                    "assignee": "hruser",
                    "createdDate": 1525868403757,
                    "priority": 50,
                    "status": "ASSIGNED"
                }
            }
]
}

Related to the issue
#1813

@lucianoprea

This comment has been minimized.

Copy link
Member

lucianoprea commented May 10, 2018

right now to get subtasks the TaskService > getSubtasks(parentTaskId) method is used.
@balsarori suggested to use

HistoricTaskInstanceQuery https://github.com/Activiti/Activiti/blob/develop/activiti-engine/src/main/java/org/activiti/engine/history/HistoricTaskInstanceQuery.java#L57
use unfinished to get only active tasks

or add parentTaskId inside TaskQuery and create a new method that will return tasks filtered on parentTaskId to support pagination and return the expected response.

@mauriziovitale

This comment has been minimized.

Copy link

mauriziovitale commented May 10, 2018

Right now the task list API returns all the task and subtasks.

http://{{domain}}/query/v1/tasks

I'd like to have a filter property to fetch only the parent tasks.

http://{{domain}}/query/v1/tasks?parentTaskId=null

@salaboy salaboy added this to the Beta3 milestone Oct 31, 2018

@salaboy salaboy added the api label Nov 7, 2018

@salaboy salaboy modified the milestones: Beta3, Beta4, Beta5 Nov 9, 2018

@salaboy salaboy assigned CTI777 and unassigned erdemedeiros Dec 21, 2018

@salaboy

This comment has been minimized.

Copy link
Member

salaboy commented Dec 27, 2018

@CTI777 the only thing that we need to do here is to implement the filter for parentTaskId = null, which means root tasks only.

https://github.com/Activiti/activiti-api/blob/develop/activiti-api-task-model/src/main/java/org/activiti/api/task/model/Task.java#L54

@salaboy

This comment has been minimized.

Copy link
Member

salaboy commented Dec 31, 2018

@mauriziovitale @CTI777 as I mention in my comments of the PR I would prefer something like

v1/tasks?rootTasksOnly  (or rootTasksOnly=true)

to avoid exposing =null to the user

@salaboy

This comment has been minimized.

Copy link
Member

salaboy commented Jan 1, 2019

ok so v1/tasks/rootTasksOnly.. implemented in develop .. We need to have a acceptance tests for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment