LogoLogo
GitHub
  • Elsa Workflows 3
  • Getting Started
    • Concepts
    • Hello World
    • Prerequisites
    • Packages
    • Containers
      • Docker
      • Docker Compose
        • Elsa Server + Studio
        • Elsa Server + Studio - Single Image
        • Persistent Database
        • Traefik
  • Application Types
    • Elsa Server
    • Elsa Studio
    • Elsa Server + Studio (WASM)
  • Guides
    • HTTP Workflows
      • Programmatic
      • Designer
    • External Application Interaction
    • Loading Workflows from JSON
    • Running Workflows
      • Using Elsa Studio
      • Using a Trigger
      • Dispatch Workflow Activity
  • Activities
    • Control Flow
      • Decision
    • MassTransit
      • Tutorial
  • Expressions
    • C#
    • JavaScript
    • Python
    • Liquid
  • Extensibility
    • Custom Activities
  • Reusable Triggers (3.5-preview)
  • Multitenancy
    • Introduction
    • Setup
  • Operate
    • Variables
    • Activation Strategies
    • Incidents
      • Strategies
      • Configuration
    • Alterations
      • Alteration Plans
        • REST API
      • Applying Alterations
        • REST API
        • Extensibility
  • Optimize
    • Log Persistence
    • Retention
  • Hosting
    • Distributed Hosting
Powered by GitBook
On this page
  1. Operate
  2. Alterations
  3. Applying Alterations

REST API

The Alterations module exposes a REST API for applying alterations directly. For example, to apply an alteration that modifies a variable, migrates the workflow instance to a new version and to schedule an activity, use the following request:

POST /alterations/run HTTP/1.1
Host: localhost:5001

{
    "alterations": [
        {
            "type": "ModifyVariable",
            "variableId": "83fde420b5794bc39a0a7db725405511",
            "value": "Hello world!"
        },
        {
            "type": "Migrate",
            "targetVersion": 9
        },
        {
            "type": "ScheduleActivity",
            "activityId": "mY1rb4GRjkW3urm8dcNSog"
        }
    ],
    "workflowInstanceIds": [
        "88ce68d00e824c78a53af04f16d276ea"
    ]
}

Notice that the JSON structure is exactly the same as when submitting a plan. The only difference is that the request is sent to the /alterations/run endpoint instead of the /alteration/submit endpoint.

The response wil include the execution results:

{
  "results": [
    {
      "workflowInstanceId": "88ce68d00e824c78a53af04f16d276ea",
      "log": {
        "logEntries": [
          {
            "message": "ModifyVariable succeeded",
            "logLevel": 2,
            "timestamp": "2023-10-05T12:35:23.197167+00:00"
          },
          {
            "message": "Migrate succeeded",
            "logLevel": 2,
            "timestamp": "2023-10-05T12:35:23.202805+00:00"
          },
          {
            "message": "ScheduleActivity succeeded",
            "logLevel": 2,
            "timestamp": "2023-10-05T12:35:23.205629+00:00"
          }
        ]
      },
      "isSuccessful": true
    }
  ]
}
PreviousApplying AlterationsNextExtensibility

Last updated 3 months ago