update_workflow_stages
imerit_ango.sdk.SDK.
update_workflow_stages(project_id, stages)
Update the workflow of your project.
Parameters
project_id: string
The unique identifier for the project. You can find the project ID in the user interface or retrieve it using the
list_projectsfunction.
stages: List[dict]
The workflow of the project, in JSON format.
Stage types and their required fields:
Start Stage
"id": "Start"
"type": "Start"
"name": "Start"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"autoForward": true or false
Complete Stage
"id": "Complete"
"type": "Complete"
"name": "Complete"
"position": {"x": 10, "y": 20}
"preventRequeue": true or false
Label Stage
"id": "<STAGE ID>"
"type": "Label"
"name": "Label"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"assignedTo": ["[email protected]", "[email protected]"]
Consensus Stage
"id": "<CONSENSUS STAGE ID>"
"type": "Consensus"
"name": "Consensus"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID AGREEMENT>", "<NEXT STAGE ID DISAGREEMENT>"]
Two types of stages, “Label” and “Plugin”, can be added to a consensus stage. They should adhere to the following format:
Label Stage:
"id": "<STAGE ID>"
"type": "Label"
"name": "Consensus_1"
"position": {"x": 0, "y": 0}
"next": ["<CONSENSUS STAGE ID>"]
"assignedTo": ["[email protected]", "[email protected]"]
"consensusId": "<CONSENSUS STAGE ID>"
Plugin Stage:
"id": "<STAGE ID>"
"type": "Plugin"
"name": "Consensus_2"
"position": {"x": 0, "y": 0}
"next": ["<CONSENSUS STAGE ID>"]
"pluginId": "<PLUGIN ID>"
"consensusId": "<CONSENSUS STAGE ID>"
Review Stage
"id": "<STAGE ID>"
"type": "Review"
"name": "Review"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID ACCEPTED>", "<NEXT STAGE ID REJECTED>"]
"assignedTo": ["[email protected]", "[email protected]"]
"readOnly": true or false
Hold Stage
"id": "<STAGE ID>"
"type": "Hold"
"name": "Hold"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
Logic Stage
"id": "<STAGE ID>"
"type": "Logic"
"name": "Logic"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID IF CONDITION>", ..., "<NEXT STAGE ID ELSE CONDITION>"]
"logic": {"conditions": [...]}
A single condition should follow:
Logic Type: Annotation Type
{"type": "AnnotationType", "value": {"tools": [{"schemaId": "<Schema ID>", "filter": ["exists"]}]}, "index": 0}
Logic Type: Assignee
{"type": "Annotator", "value": ["[email protected]"], "index": 0}
Logic Type: Random Sample
{"type": "RandomSample", "value": 0.100", "index": 0 ]}
Logic Type: Task Duration
{"type": "Duration", "value": [Start Time, End Time], "index": 0}
Logic Type: Batch
{"type": "Batch", "value": ["<SELECTED BATCH ID>"], "index": 0}
Plugin Stage
"id": "<STAGE ID>"
"type": "Plugin"
"name": "Plugin"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"pluginId": "<PLUGIN ID>"
Webhook Stage
"id": "<STAGE ID>"
"type": "Webhook"
"name": "Webhook"
"position": {"x": 10, "y": 20}
"next": ["<NEXT STAGE ID>"]
"webhook": {"secret": "<SECRET>", "url": "<URL>"}
Note: To get an idea of what you can pass as input in Stages, you may create a workflow in a project, then run:
As the returned JSON, you'll get the JSON representation of the project's workflow, which you can use as a skeleton to create your own workflow JSONs.
Returns:
output: dict
A dictionary containing the result of the operation.
Including a
statusfield indicating whether the request was successful and adatafield containing the response payload with updated resources produced by the operation.
Example
Create a workflow from scratch
Disable the "Auto Forward on Upload" option on the Start stage
Prevent requeueing to Complete stage
See also
Last updated