business-process-managementibm-bpm

How to extract all task ID's for a specific user IBM BPM


I am trying to extract the task ID's for a specific user ( using username) in the IBM BPM REST API tester.

I have tried using the following command but it does not return the task ID

rest/bpm/wle/v1/search/query?columns=taskId%2C&condition=userName%7COSHVWYK&organization=byInstance&run=true&shared=false&filterByCurrentUser=false

Solution

  • Your condition is misformatted. On IBM BPM 8.6 go to REST API Tester / Business Process Manager REST APIs / Search API / Run Query [deprecated] and specify Condition as assignedToUser|Equals|user123 (replacing user123 with real user name); note that list of columns allowed in Condition is available under /rest/bpm/wle/v1/search/meta/constraintColumn. Adding to Columns value of taskId will narrow returned data set, so this is optional.

    Result URL looks then this way: rest/bpm/wle/v1/search/query?condition=assignedToUser%7CEquals%7Cuser123&organization=byInstance&run=true&shared=false&filterByCurrentUser=false

    And result set will have structure like following:

    {
        "status": "200",
        "data": {
            "data": [{
                    "assignedToRole": null,
                    "taskAssignedTo": {
                        "type": "User",
                        "who": "user123"
                    },
                    "instanceId": 308611,
                    "instanceStatus": "Terminated",
                    "taskAttachedExtActivityRef": null,
                    "taskAttachedInfoPathFormRef": null,
                    "taskId": 613750,
                    "taskStatus": "Closed"
                }, {
                    "assignedToRole": null,
                    "taskAssignedTo": {
                        "type": "User",
                        "who": "user123"
                    },
                    "instanceId": 308622,
                    "instanceStatus": "Terminated",
                    "taskAttachedExtActivityRef": null,
                    "taskAttachedInfoPathFormRef": null,
                    "taskId": 613763,
                    "taskStatus": "Closed"
                }, ... ]
        }
    }