We expose through the REST API two new kind of resources:
- Workflow : a workflow instance
- Task: a task instance
In the future, we will probably add WorkflowModel.
Workflow resource exposes the following information:
- id
- name (that comes from the workflow template)
- AttachedDocuments (ids)
- WorkflowVariables
- NodesList (can be used for building the graph, no needed to have a "Nodee ressource, it can just be an array with position information etc...)
- StartTime
- workflowParent (optional)
- workflowParentNode:(name of the parent node)
Task resource exposes the following information:
- id
- name (title of the task, usually equal to node_name)
- node_name( template id of the node that produced the task)
- state (cancelled, opened, ended)
- status (completing status = which button was clicked)
- variables (where we find variables transmitted when completing the task
- targetDocuments (note: currently on the task object, there is only targetDocumentId, this should be an evolution, so as to be consistent on the whole api, as we can start a workflow on a list of documents).
- actors (= assignees)
- directive
- comment
- workflowId
- workflowName (not implemented yet, enable to sort by process model)
- created
- due date
- Create and start a workflow instance:
POST /api/workflow/ (in the body : a Workflow resource with at least name and variables)
Optionally,can tell to also start the wf in the body
- Create and Start a workflow instance on a document:
POST /api/id/{documentId}/@wf/ (in the body : a Workflow resource with at least name and variables)
It returns a workflow resource.
- Fetch a workflow instance:
GET /api/workflow/{workflowId}
It returns a workflow resource
- Cancel a workflow instance (only for administrators group and initiator of the workflow)
DELETE /api/workflow/{workflowId}
- Get tasks related to a given workflow on a given document (not related to a user)
GET /api/id/{docId}/@wf/{workflowId}/@tasks/ (if workflowId is null ---> all open the tasks of all processes on the document)
TODO: extract adapters in the spec
- Complete a task
PUT /api/task/{taskId}/complete ( in the body: a Task resource)
- Get tasks related to a user (for doing a user dashboard)
GET /api/task (returns all the tasks assigned to current user)
GET /api/task?user={userId} (returns all the tasks assigned to the user)
- Get tasks for a given process name
GET /api/task?userId={userId}&workflowId={workflowId}
- Get running workflows launched by the user
GET /api/workflow/
1.
|
Specify WF API | Resolved | Vladimir Pasquier |