This document describes how to start and monitor a Process via the Curator API.
This is a three-phase process; first, get the process definition Id, then start the process, and finally, monitor the process.
Preparation
All requests here are assumed to be made with the following headers:
- Content-Type: application/json
- Accept: application/json
Step 1: Getting the Process Definition Id
POST to http://[Process Engine Server Host]:11170/ProcessEngineService/web/processdefinition/name
{ "name": "[Process Definition Name]" } |
This will return the process definition:
{ "GetProcessDefinitionByNameResult": { "Arguments": [], "CreatedDateTime": "/Date(1548178774000+0000)/", "Description": "Process Definition Description", "Id": "54b49d7a-b7c5-4697-82b9-15dbb8933822", "LoadFailureMessage": null, "Metadata": [], "ModifiedDateTime": "/Date(1548178774000+0000)/", "Name": "Process Definition Name", "SourcePackage": null, "SourcePackageVersion": null, "Valid": true, "Xaml": "<a_large_block_of_xml />" } } |
The only important part here is the Id which is used in the next call.
Step 2: Starting the Process
POST to http://[Process Engine Server Host]:11170/ProcessEngineService/web/processes/create
This will need the Definition Id filled in with the previous block, and any arguments filling in. If there are no arguments, that field is not required.
{ "process": { "Name": "Test", "DefinitionId": "[DefinitionId]", "Arguments": [ { "Name": "[ArgumentName]", "Expression": "[ArgumentExpression]" } ], "Token": "Created with postman" } } |
This will return a result:
{ "CreateProcessResult": { "Arguments": [], "Children": 0, "DefinitionId": "54b49d7a-b7c5-4697-82b9-15dbb8933822", "FinishedDateTime": "/Date(-62135596800000+0000)/", "Id": "1b6f2cf9-533e-4409-a340-5c9c08310868", "LastTrackingRecord": null, "Name": "Test", "OriginId": null, "Parent": "00000000-0000-0000-0000-000000000000", "QueuedDateTime": "/Date(-62135596800000+0000)/", "StartConditions":null, "StartedDateTime": "/Date(-62135596800000+0000)/", "Status": { "Value": 2 }, "StatusMessage": null, "SubmittedDateTime": "/Date(-62135596800000+0000)/", "Token": "Created with postman", "UserId": null, "WorkflowId": "00000000-0000-0000-0000-000000000000", "Xaml": "<a_large_block_of_xml />" } } |
Again, the Id field is important here as this is used to track the Process.
Step 3: Tracking the Process
POST to http://[Process Engine Server Host]:11170/ProcessEngineService/web/process
The Process Instance Id will be needed from the Create Process API call.
{ "processId": "[Process Instance Id]", "lightweight": true } |
This will return a process instance such as:
{ "GetProcessResult": { "Arguments": [], "Children": 0, "DefinitionId": "54b49d7a-b7c5-4697-82b9-15dbb8933822", "FinishedDateTime": "/Date(1552578895000+0000)/", "Id": "1b6f2cf9-533e-4409-a340-5c9c08310868", "LastTrackingRecord": null, "Name": "Test", "OriginId": null, "Parent": "00000000-0000-0000-0000-000000000000", "QueuedDateTime": "/Date(1552578895000+0000)/", "StartConditions": null, "StartedDateTime": "/Date(1552578895000+0000)/", "Status": { "Value": 4 }, "StatusMessage": null, "SubmittedDateTime": "/Date(1552578895000+0000)/", "Token": "Created with postman", "UserId": null, "WorkflowId": "cae40c04-84f0-4586-b305-934caf1bd47c", "Xaml": null } } |
What is important here is the Status field. That will return one of the following values:
Number | Value | Definition |
---|---|---|
2 | Executing | The process is currently running |
4 | Succeeded | The process has completed successfully |
8 | Faulted | The process failed. The Status Message field gives more details |
16 | Canceled | The process was canceled by a user |
32 | Queued | The process is waiting to be executed when the server has capacity |
64 | Pending | The process has not yet been queued |
NOTE: There may be other values in future versions of Process Engine.