Skip to content

REST Variables

Akram El Assas edited this page Sep 3, 2024 · 2 revisions

Local variables and global variables values are set before the workflow is started.

With REST variables, you can set values at runtime when you start a workflow.

REST variables cannot be set from the dashboard at the moment. You need to use Wexflow API from your application or through Swagger: http://localhost:8000/

To send variables when starting a workflow, use the following endpoint:

POST http://localhost:8000/api/v1/start-with-variables

Here is a sample payload:

{
	"WorkflowId":131,
	"Variables":[
	  {
		 "Name":"restVar1",
		 "Value":"C:\\WexflowTesting\\file1.txt"
	  },
	  {
		 "Name":"restVar2",
		 "Value":"C:\\WexflowTesting\\file2.txt"
	  }
	]
}

Here is a sample workflow:

<Workflow xmlns="urn:wexflow-schema" id="138" name="Workflow_RestVariables" description="Workflow_RestVariables">
  <Settings>
    <Setting name="launchType" value="trigger" />
    <Setting name="enabled" value="true" />
  </Settings>
  <LocalVariables></LocalVariables>
  <Tasks>
    <Task id="1" name="FilesLoader" description="Loading files" enabled="true">
      <Setting name="file" value="$restVar1" />
      <Setting name="file" value="$restVar2" />
    </Task>
    <Task id="2" name="ListFiles" description="Listing files" enabled="true"></Task>
  </Tasks>
</Workflow>
Clone this wiki locally