A minimal backend service for managing configurable state-machine workflows built with .NET 8.
- .NET 8 SDK installed
- Any code editor (VS Code recommended)
git clone https://github.com/Akshat-jwr/Configurable-Workflow-Engines.git
cd Infonetica-Task
dotnet runThe API will be available at: http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/workflows |
Create a new workflow definition |
GET |
/api/workflows/{id} |
Get workflow definition by ID |
GET |
/api/workflows |
List all workflow definitions |
PUT |
/api/workflows/{id} |
Update workflow definition |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/workflows/{workflowId}/instances |
Start new workflow instance |
GET |
/api/instances/{id} |
Get instance details with history |
GET |
/api/instances |
List all workflow instances |
GET |
/api/workflows/{workflowId}/instances |
Get instances by workflow |
POST |
/api/instances/{instanceId}/transitions |
Execute transition on instance |
You can test these on postman or bash
POST http://localhost:5000/api/workflows
{
"id": "order-workflow",
"name": "Order Processing",
"states": [
{
"id": "pending",
"name": "Order Pending",
"isInitial": true,
"isFinal": false,
"enabled": true
},
{
"id": "processing",
"name": "Processing Order",
"isInitial": false,
"isFinal": false,
"enabled": true
},
{
"id": "completed",
"name": "Order Completed",
"isInitial": false,
"isFinal": true,
"enabled": true
}
],
"transitions": [
{
"id": "start-processing",
"name": "Start Processing",
"enabled": true,
"fromStates": ["pending"],
"toState": "processing"
},
{
"id": "complete-order",
"name": "Complete Order",
"enabled": true,
"fromStates": ["processing"],
"toState": "completed"
}
]
}
POST http://localhost:5000/api/workflows/order-workflow/instances
{
"instanceId": "order-12345"
}POST http://localhost:5000/api/instances/order-12345/transitions
{
"transitionId": "start-processing"
}Then execute the next transition:
{
"transitionId": "complete-order"
}GET http://localhost:5000/api/instances/order-12345
You'll see the current state and complete history of transitions.
- id: Unique identifier
- name: Display name
- isInitial: True for starting state (exactly one per workflow)
- isFinal: True for ending states
- enabled: Whether the state is active
- id: Unique identifier
- name: Display name
- enabled: Whether transition can be executed
- fromStates: Array of valid source states
- toState: Target state (single state only)
- Collection of states and transitions
- Must have exactly one initial state
- All transitions must reference valid states
- Running copy of a workflow definition
- Tracks current state and execution history
- Starts at the initial state
- Must have exactly one initial state
- State IDs must be unique
- Transition IDs must be unique
- All transition references must be valid states
- Transition must exist in workflow
- Transition must be enabled
- Current state must be in transition's fromStates
- Cannot execute transitions on final states
All errors return appropriate HTTP status codes with JSON responses:
{
"error": "Validation Error",
"message": "Detailed error description"
}Create workflow:
curl -X POST http://localhost:5000/api/workflows
-H "Content-Type: application/json"
-d @workflow.jsonStart instance:
curl -X POST http://localhost:5000/api/workflows/order-workflow/instances
-H "Content-Type: application/json"
-d '{"instanceId": "order-123"}'Execute transition:
curl -X POST http://localhost:5000/api/instances/order-123/transitions
-H "Content-Type: application/json"
-d '{"transitionId": "start-processing"}'