Retrieve all the active/completed tasks with form variables using REST API

Hi,

Can anyone provide the information for the following scenarios,

  1. I want to retrieve all tasks active/completed from REST API.
    I am Using “/engine-rest/task?processDefinitionKey=”, but it only gives me active tasks.

  2. Is there any way to retrieve all tasks with its forms variables for a particular definitionkey
    Currently I am doing it by following way:
    First Retrieve all tasks using “/engine-rest/task?processDefinitionKey=” API
    Then retrieve forms variables using each processId which are retrieved from above service

Still in both scenarios I am unable to retrieve completed tasks.As I need to show active/completed processes on my Webapp UI.

Thank you,
Jignesh Pithva.

Hi,

you could use the history for this.
See the history task query for more informations.

This query will return all tasks. It is also possible to: ‘Only include tasks that belong to process instances that have variables with certain values.’ For that use the processVariables query parameter.

Hope that helps.

Greets
Chris

Hi Chris,

Thanks for the help :slight_smile: . Now I am able to retrieved active/completed tasks by using query parameters finished/unfinished as true/false in “/engine-rest/history/task” REST API.

For the process variables, I need all tasks with its all process variables which I have created on starting process flow. I am not getting those process variables using above REST API.For getting those variables I am using “engine-rest/process-instance/{ProcessInstanceId}/variables” REST API.

As you suggested by using processVariables(key_operator_value) query parameter I think I can only filter out tasks. By using this query parameter I need to remember process variables and it’s values as expression said.

I need to display all the processes on UI in table, where table columns values will be process variables values, no matter what process variables have. I just need to display as it is.

Thank you,
Jignesh Pithva.

Hi,

I’m not sure if I understand you correctly.

You want to get all processes with specific variables?
Or you want get all processes AND there variables?

Greets,
Chris

Hi Chris,

I need all the processes and their all process variables.
I want process variables (which I am getting using “engine-rest/process-instance/{ProcessInstanceId}/variables”) with /engine-rest/history/task" REST API.

Thank you,
Jignesh Pithva.

1 Like

@pithvajignesh @Niall could you pls help me to get the ACTIVE/Completed task list with the help of POST TASK/GET TASK API for camunda? if yes what would be the query/request body JSOn for same? thank you in advance.