REST API: Get tasks list for user for both the candidate and assignee

Hi everyone,

Is it possible to get a list of tasks for user via REST API where the user is both the assignee and the candidate?

@mms if you are querying for active task instances: POST /task api, then use below payload.

{
   "assignee":"demouser",
   "candidateUser":"demouser",
    .....
}

To filter task instances with more criteria, refer /rest/task/post-query/.

If you are looking for historic task instances: POST /history/task, then refer below:

{
    "taskAssignee":"demouser",
    "taskHadCandidateUser":"demouser",
    .....
}

To filter historic task instances with more criteria, refer /rest/history/task/post-task-query/.

This method has the same behavior as GET /task?assignee=userName&candidateUser=userName :frowning:
Result is tasks having userName as assignee AND candidateUser. But how can I get tasks where userName can be assignee OR candidateUser?

@mms you can try like this below:

{  
  "orQueries": [
    {
      "assignee": "demouser"
    },
	{
      "candidateUser": "demouser"
    }
  ]
} 

Note: OR queries is not supported for querying historic task instances.

@aravindhrs still no luck :frowning:

for example:

  • User ‘userName’ has assigned task

request:

{  
  "orQueries": [
    {
      "assignee": "userName"
    }
  ]
}   

produces expected output. But when I post:

{  
  "orQueries": [
    {
      "assignee": "userName"
    },
	{
      "candidateUser": "userName"
    }
  ]
} 

Result is empty array.

Hi @mms
Were you able to get this work?

@Suhas_Kulkarni nope. I solved this problem making two request:
/task?candidateUser=${userName}&includeAssignedTasks=true
/task?assignee=${userName}
and combining the responses