Legacy Dev Forum Posts

 View Only

Sign Up

Start workflow flow over API

  • 1.  Start workflow flow over API

    Posted 06-05-2025 19:15

    ciwe | 2023-06-16 15:28:20 UTC | #1

    Hi,

    I want to start a workflow over the API: POST /api/v2/flows/executions

    I have some input variables in my workflow and want to input the values from API call into that workflow. I always get the following error back when I grab the result over API, too:

    GET /api/v2/flows/executions/{flowExecutionId}

    result:

    ... "status": "FAILED",

    • "dateCompleted": "2023-06-16T15:12:33.800Z",*
    • "completionReason": "Failure",*
    • "flowErrorInfo": {*
    • "message": "An expression (or part of an expression) resulted in a null where one is disallowed.",*
    • "code": "error.workflow.expression.unexpectedNull",*
    • "messageWithParams": "An expression (or part of an expression) resulted in a null near position {pos} where one is disallowed in expression '{expression}'.",*
    • "messageParams": {*
    • "expression": "Flow.userEmail",*
    • "pos": "0"*
    • },*

    ...

    My variables in workflow like this:

    I use a Data Action to test the API call. This is what is send in POST request to start the workflow:

    "{\n \"flowId\": \"8824ba71-9b2b-4e24-8739-5b359719a000\",\n \"flowVersion\": \"2\",\n \"name\": \"executionOne\",\n \"inputData\": {\n \"Flow\" : {\n \"myBool1\": false,\n \"myString1\": \"test1\",\n \"myInt1\": 1,\n \"userEmail\": \"Christian.Werner-Berger@t-systems.com\"\n }\n }\n}"

    This is my request body template in the Action for better reading:

    { "flowId": "${input.flowId}", "flowVersion": "${input.flowVersion}", "name": "executionOne", "inputData": { "Flow" : { "myBool1": ${input.myBool1}, "myString1": "${input.myString1}", "myInt1": ${input.myInt1}, "userEmail": "${input.userEmail}" } } }

    What do I wrong so that Flow.userEmail can't be recognized in my workflow and the following block crashed there?

    Thank you and best regards, Christian.


    Kevin_Walsh | 2023-06-20 09:22:35 UTC | #2

    Hi Christian,

    I'm not sure you require the Flow block within the inputData. From the API help it defines:

    inputData
    (object, optional): Input values to the flow. Valid values are defined by a flow's input JSON schema.

    And when I get the flow information of one of my flows it defines the following:

    "inputSchema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "title": "Flow input schema",
        "description": "Schema defining flow input parameters.  Property names map to flow scoped variables marked as a flow input.  If you do not supply a property value for an input variable, the variable value will be set to the initial value configured on it in the flow at flow startup.",
        "type": "object",
        "properties": {
          "Slot.AccountType": {
            "description": "Variable for the 'AccountType' slot.",
            "$ref": "#/definitions/archString"
          },
          "Slot.Upgrade": {
            "description": "Variable for the 'Upgrade' slot.",
            "$ref": "#/definitions/archString"
          }
        },

    Which would suggest the following should suffice:

    "inputData": {
        "myBool1": ${input.myBool1},
        "myString1": "${input.myString1}",
        "myInt1": ${input.myInt1},
        "userEmail": "${input.userEmail}"
    }

    Regards,

    Kevin


    ciwe | 2023-06-20 10:22:16 UTC | #3

    Kevin_Walsh, post:2, topic:20500
    inputSchema

    Hello Kevin,

    thanks for your reply.

    Unfortunately I get the exact same error when I try it like you expressed:

    This is the full response:

    {
      "id": "ia23k38g95qe6dimjh44kbmf1ppbcqpe6d0000qr80samqrce5",
      "name": "executionOne",
      "flowVersion": {
        "id": "2.0",
        "name": "2.0",
        "commitVersion": "2.0",
        "configurationVersion": "2.0",
        "secure": false,
        "debug": false,
        "createdBy": {
          "id": "bacb8dda-0061-4a67-9fa9-c55c9b616f2b",
          "selfUri": "/api/v2/users/bacb8dda-0061-4a67-9fa9-c55c9b616f2b"
        },
        "configurationUri": "/api/v2/flows/8824ba71-9b2b-4e24-8739-5b359719a000/versions/2.0/configuration",
        "dateCreated": 1686926279208,
        "dateCheckedIn": 1686926279218,
        "dateSaved": 1686926278309,
        "generationId": "WORKFLOW_VERSION_PUBLISHED",
        "inputSchema": {
          "$schema": "http://json-schema.org/draft-07/schema#",
          "title": "Flow input schema",
          "description": "Schema defining flow input parameters.  Property names map to flow scoped variables marked as a flow input.  If you do not supply a property value for an input variable, the variable value will be set to the initial value configured on it in the flow at flow startup.",
          "type": "object",
          "properties": {
            "Flow.myBool1": {
              "$ref": "#/definitions/archBoolean"
            },
            "Flow.myInt1": {
              "$ref": "#/definitions/archInteger"
            },
            "Flow.myString1": {
              "$ref": "#/definitions/archString"
            },
            "Flow.userEmail": {
              "$ref": "#/definitions/archString"
            }
          },
          "additionalProperties": false,
          "definitions": {
            "archString": {
              "archDataTypeId": "str",
              "oneOf": [
                {
                  "type": "null",
                  "description": "A NOT_SET String value."
                },
                {
                  "type": "string",
                  "maxLength": 32000,
                  "description": "A character string.  Examples: \"\", \"Hello\", \"Just say \\\"No!\\\"\""
                }
              ]
            },
            "archBoolean": {
              "archDataTypeId": "bln",
              "oneOf": [
                {
                  "type": "null",
                  "description": "A NOT_SET Boolean value."
                },
                {
                  "type": "boolean",
                  "description": "A true/false boolean value.  Examples: true, false"
                }
              ]
            },
            "archInteger": {
              "archDataTypeId": "int",
              "oneOf": [
                {
                  "type": "null",
                  "description": "A NOT_SET Integer value."
                },
                {
                  "type": "integer",
                  "minimum": -999999999999999,
                  "maximum": 999999999999999,
                  "description": "An integral numeric value.  Examples: -3, 0, 1736"
                },
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16,
                  "description": "A string representation of an integral numeric value.  Examples: \"157\", \"-999999999999999\""
                }
              ]
            }
          }
        },
        "outputSchema": {
          "$schema": "http://json-schema.org/draft-07/schema#",
          "title": "Flow output schema",
          "description": "Schema defining flow output parameters.  Property names map to flow scoped variables marked as a flow output.",
          "type": "object",
          "properties": {
            "Flow.myBool1": {
              "$ref": "#/definitions/archBoolean"
            },
            "Flow.myInt1": {
              "$ref": "#/definitions/archInteger"
            },
            "Flow.isUserFound": {
              "$ref": "#/definitions/archBoolean"
            },
            "Flow.myString1": {
              "$ref": "#/definitions/archString"
            },
            "Flow.foundUserName": {
              "$ref": "#/definitions/archString"
            }
          },
          "additionalProperties": false,
          "definitions": {
            "archString": {
              "archDataTypeId": "str",
              "oneOf": [
                {
                  "type": "null",
                  "description": "A NOT_SET String value."
                },
                {
                  "type": "string",
                  "maxLength": 32000,
                  "description": "A character string.  Examples: \"\", \"Hello\", \"Just say \\\"No!\\\"\""
                }
              ]
            },
            "archBoolean": {
              "archDataTypeId": "bln",
              "oneOf": [
                {
                  "type": "null",
                  "description": "A NOT_SET Boolean value."
                },
                {
                  "type": "boolean",
                  "description": "A true/false boolean value.  Examples: true, false"
                }
              ]
            },
            "archInteger": {
              "archDataTypeId": "int",
              "oneOf": [
                {
                  "type": "null",
                  "description": "A NOT_SET Integer value."
                },
                {
                  "type": "integer",
                  "minimum": -999999999999999,
                  "maximum": 999999999999999,
                  "description": "An integral numeric value.  Examples: -3, 0, 1736"
                },
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16,
                  "description": "A string representation of an integral numeric value.  Examples: \"157\", \"-999999999999999\""
                }
              ]
            }
          }
        },
        "datePublished": "2023-06-16T14:37:59.279Z",
        "supportedLanguages": [
          {
            "language": "en-us",
            "isDefault": true
          }
        ],
        "selfUri": "/api/v2/flows/8824ba71-9b2b-4e24-8739-5b359719a000/versions/2.0"
      },
      "dateLaunched": "2023-06-20T10:16:39.974Z",
      "status": "FAILED",
      "dateCompleted": "2023-06-20T10:16:40.162Z",
      "completionReason": "Failure",
      "flowErrorInfo": {
        "message": "An expression (or part of an expression) resulted in a null where one is disallowed.",
        "code": "error.workflow.expression.unexpectedNull",
        "messageWithParams": "An expression (or part of an expression) resulted in a null near position {pos} where one is disallowed in expression '{expression}'.",
        "messageParams": {
          "expression": "Flow.userEmail",
          "pos": "0"
        },
        "details": [],
        "errors": []
      },
      "selfUri": "/api/v2/flows/executions/ia23k38g95qe6dimjh44kbmf1ppbcqpe6d0000qr80samqrce5"
    }

    So when I look at the flow input schema in the response I would say my version I posted before was correct. But the exception in the Flow I would interpret like this that Flow is null, isn't it? Maybe I am blind to find the error in the flow?

    Thanks and best regards, Christian.


    ciwe | 2023-06-20 11:12:23 UTC | #4

    I can answer that question now myself.

    This is the correct input request object in the Data Action which called the Workflow flow:

    This is not really clear for me why this should be like this but this is working. And it is the same when I request the response from the Workflow over Data Action as well.

    This is a JSON example:

    So no nested objects in JSON but only flat attribute names...

    Greets, Christian.


    system | 2023-07-21 11:12:43 UTC | #5

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 20500