All Products
Search
Document Center

Logic Composer:Overview

Last Updated:Feb 27, 2023

This topic describes how to define a workflow.

Logically, a workflow contains at least one trigger and the actions to be performed. Currently, you can only use JSON syntax to define a workflow. The outermost layer of the workflow definition is as follows:

{
  "schemaVersion": "${flow-schema-version}",
  "triggers": { "${flow-trigger-definitions}" },
  "actions": { "${flow-action-definitions}" }
}

Field

Required

Description

schemaVersion

No

The version of the schema used by the workflow.

triggers

No

Specifies one or more triggers for the workflow.

actions

No

Specifies one or more actions to be performed when the workflow is running.

schemaVersion

The version of the schema used by the workflow. Currently, workflows support only the 2018-12-12 version.

triggers

All workflows start with a trigger. A trigger defines the code that can be called to instantiate and start a workflow.

"${trigger-name}": {
   "type": "${trigger-type}",
   "inputs": { "${trigger-inputs}" },
},

Field

Type

Description

${trigger-name}

String

The name of the trigger

type

String

The type of the trigger. For example, request specifies a trigger of the HTTP request type.

inputs

JSON object

The input parameters of the trigger.

Example of an HTTP request trigger:

"request": {
   "type": "Request",
   "kind": "Http",
   "inputs": {
      "method": "${method-type}",
      "schema": {
         "type": "object",
         "properties": {
            "${property-name}": {
               "type": "${property-type}"
            }
         },
         "required": [ "${required-properties}" ]
      }
   }
}

The inputs field defines the input parameters of the trigger.

Field

Type

Description

${method-type}

String

The request method. Valid values: GET, PUT, POST, PATCH, and DELETE.

schema

JSON object

The schema of input parameters, which must comply with the standard JSON schema format. The schema is used for verifying input parameters.

actions

An action is performed to run a specific connector by using some parameters.

Each action is defined in the following standard syntax. Some connectors provide more configuration items. For more information, see the configuration items of the corresponding connector.

"${action-name}": {
   "type": "HTTP",
   "inputs": {
      "uri": "https://example.com/api",
      "method": "GET",
      "headers": {
        "User-Agent": "Logic Composer"
      }
    },
    "runAfter": {}
}

Field

Required

Type

Description

type

Yes

String

The name of the connector corresponding to the action.

inputs

Yes

Int, Float, Boolean, or JSON object

The input parameters of the connector. For more information, see the configuration items of the corresponding connector.

runAfter

Yes

JSON object

The name and result of the trigger or action that must be completed before the current action can be performed.

For example, the following action returns a response after another action is successful:

"Return a response": {
   "type": "Response",
   "inputs": {
     "body": "@body('request API')"
   },
   "runAfter": {
     "Request API": ["Succeeded"]
   }
},