Flowable rest api

Hello,

I have several questions about the flowable rest api.
Currently, I am using flowable rest-api in python.

The app is for file uploading from the client. After the uploading is done from the client, the information will be sent to the microservice to save it.

flowable-node

The first http request successfully passed the body to the microservice.
But for receive task, I sent a post request to ‘/service/query/executions’ with this payload.

payload = {
    'processInstanceId': process_instance_id (<- execution.getProcessInstance() from the 1st http task),
    'activityId': 'check-file-existed' (<-name of the receive task)
}

But the result is {“data”:[],“total”:0,“start”:0,“sort”:“processInstanceId”,“order”:“asc”,“size”:0}.

Questions.

  1. I am wondering why the result data is empty, even if the process_instance_id is not null.
  2. When the processInstanceId is created, how the processinstanceId interact with acitivityIds within the same deployment?
  3. when is activityid available to use?
  4. What is the ‘completed’ in the result? Even if I’ve got the right result, completed is False.

Best Regards,
Anna

That’s technically not possible, a process instance always has one id. Are you sure the instance is still being executed?

An instance will visit all activities, according to the sequence flow.

Not sure what you mean with this?

I don’t see any ‘completed’ in the response - where do you see this?

Hello Joram,
Thanks for your kind answers.

According to your answer, the process instance will visit all activities.

Flowable rest api - Flowable Engine - Flowable and 11 more pages - Work - Microsoft Edge

Please find out the process that I’ve tried…

  1. post request to /service/runtime/process-instances

  2. The process instance id is executed by ${execution.getProcessInstance()} in the first node (Request Insert Data).

  3. post request to /service/query/executions with processInstanceId and activityId(wait-finish-flag).
    But, the result of the /service/query/executions is
    {“data”:[],“total”:0,“start”:0,“sort”:“processInstanceId”,“order”:“asc”,“size”:0}
    So, I couldn’t send put request to /service/query/executions because there is no execution ID from #2.

  4. So, I’ve tried to send post request to /service/query/executions after getting result from the post request (/service/runtime/process-instances) is done.
    – post request to /service/query/executions with processDefinitionKey and activityId.

And the result is below…
{‘data’: [{‘id’: ‘91d32bb5-d578-11ec-ad74-0242ac110004’, ‘url’: ‘http://localhost/flowable-rest/service/runtime/executions/91d32bb5-d578-11ec-ad74-0242ac110004’, ‘parentId’: ‘91d32bb3-d578-11ec-ad74-0242ac110004’, ‘parentUrl’: ‘http://localhost/flowable-rest/service/runtime/executions/91d32bb3-d578-11ec-ad74-0242ac110004’, ‘superExecutionId’: None, ‘superExecutionUrl’: None, ‘processInstanceId’: ‘91d32bb3-d578-11ec-ad74-0242ac110004’, ‘processInstanceUrl’: ‘http://localhost/flowable-rest/service/runtime/process-instances/91d32bb3-d578-11ec-ad74-0242ac110004’, ‘suspended’: False, ‘activityId’: ‘receiveTest’, ‘tenantId’: ‘’}], ‘total’: 1, ‘start’: 0, ‘sort’: ‘processInstanceId’, ‘order’: ‘asc’, ‘size’: 1}

  1. put request to /service/query/executions after #3

  2. wait-finish-flag was available and Notification Node was successfully run.

I am using REST API from the postman. Flowable engine is deployed by docker image.
And I don’t think the process from #3 to #5 is correct.

Would you please let me know how I can access the each activities while the process is running?

Best Regards,
Anna

Ok - and in step 3:

  • What happens when you only use the process instance id?
  • Could it be that you’re calling it too quickly - i.e. the http task is still being done?

I don’t see anything that would explain what you’re seeing, the process you’re using is simple and straight-forwards. There should be an execution coming back that’s waiting in the receive task.