Skip to main content

Server Flow

Server Flows provide a structured way to define backend logic using a low-code approach. With support for database operations, API calls, conditional logic, loops, and error handling, they form the backbone of robust application logic. Server Flows can also be exposed as APIs for seamless integration with external systems.

Key Features of Server Flows​

  • Reusable — Can be used across multiple Server flows and UI interactions (as API).
  • Synchronous & Asynchronous Execution — Supports different execution modes.
  • Database Operations — Perform database operations.
  • API Integration — Call external REST APIs.
  • Error Handling — Handle exceptions and errors gracefully.
  • Custom Actions — Define advanced logic using queries, stored procedures, and external libraries.
  • Expose as API — Option to publish the flow as an API for external consumption.
  • Transformation — Supports transformation using liquid templates.

Create a Server Flow​

Step 1: Create a Folder for Organization​

  1. Open Explorer Menu in OwlGen.
  2. Right-click Server Flows and select Add Folder.
  3. Provide a meaningful name for the folder (e.g., UserManagement).
  4. The folder helps in organizing related server flows.

Step 2: Create the Server Flow​

  1. Right-click the newly created folder and select Add.
  2. In the Properties Panel, configure the following:
PropertyDescriptionComments
Name*Name of a Server flow.Name must start with a character followed by alphanumeric or '_'. No spaces are allowed. Except underscore (_), no other special characters are allowed. Name cannot start with a number.
GroupName of the folder is displayed here.This property cannot be edited.
Expose as Api*Specify whether to expose the flow as an API or not. Either Yes or No.By default, it is set to No. If yes, it enables Api Definition information.
Async Operation*Specify whether the flow is an async operation or not. Either Yes or No.By default, it is set to Yes.
DescriptionSummary of the Server flow.-
Is ActiveSpecify whether the server flow is active for accessing or not. Either Yes or No.By default, it is set to Yes.
  1. Click Save to create the Server Flow.
  2. A confirmation message "Server Flow added successfully" appears.

If Expose as Api is set to Yes, Then Api definition information is enabled

API Definition Information​

PropertyDescriptionComments
Verb TypeHTTP methods supported (GET, POST, PUT, DELETE, etc.).Specifies a server flow to handle GET, POST, PUT, DELETE requests.
Produces*Specifies the media type that the Sever flow can return in the response.JSON: returns JSON response
TEXT: returns plaintext response
XML: returns XML response
FILE: returns binary data (files, img., etc)
Consumes*Specifies the media type that the Sever flow can accept in the request body.JSON: request of JSON format
TEXT: request of plaintext format
XML: request of XML format
URLENCODED: request of form-encoded format
FORMDATA: request of multipart form data
Enable Other Status Codes*Specify a custom HTTP status code. By default, it is set to No.404 specifies not found
401 Unauthorized
400 Bad Request
301 redirect URL
200 OK
201 Created
URL*Specify the URL for Server flow.-
DescriptionSummary of the Api definition.-

Structure of a Server Flow​

The created server flow contains the following:

  • Path Params
  • Query Params
  • Request Body
  • Headers
  • Output Param
  • Variables
  • Exceptions. A base exception is created by default when a server flow is created
TypeDescriptionComments
Path ParamsUsed to pass values directly in the URL. Defined in the route template.Required parameters. Path Params added here should also be added in the action URL of the server flow e.g., if userId and orderId are the path parameters then URL: users/{userId}/orders/{orderId}
Query ParamsUsed to pass optional parameters in the URL after ?Suitable for filtering, sorting, and optional values.
Request BodyUsed for sending structured data in the request body.Works with POST, PUT, and PATCH methods.
Out ParamsExpected response from API
HeadersUsed to pass metadata like authentication, API keys, and content type.
ExceptionsSpecify the Exception Handlers for the custom exceptions.

Adding Parameters to the Server Flow​

Parameters help define input and output values used in the flow. You can add:

  • Path Parameters (Required values in the URL, e.g., users/{userId}/orders/orderId)
  • Query Parameters (Optional values in the URL, e.g., users?name=John)
  • Request Body (Data sent in POST, PUT, PATCH, DELETE requests)
  • Headers (Metadata such as authentication tokens, API keys)
  • Output Parameters (Expected API response)

Step 1: Open the Server Flow​

  1. Click on the newly created Server Flow.
  2. The Server Flow Designer Canvas appears with default Start and Stop constructs.

Step 2: Add Parameters​

  1. Right-click on Path Params, Query Params, Output Param, Variables, or Headers.
  2. Select Add.
  3. A pop-up window appears where you can configure the parameter properties.
  4. Click Save. A success message "Parameter added successfully" appears.
PropertyDescription
Parameter Name*Name of the parameter (must start with a letter, can contain _ but no spaces).
Is ArraySet to Yes if the parameter is an array, otherwise No.
Data Type*Select the parameter type (String, Number, Boolean, Object, etc.). Only primitive and primitive array types are allowed in query and path parameters.
Is MandatorySet to Yes if this parameter is required.
DescriptionProvide a summary of the parameter's purpose.

Handling Exceptions​

  1. Right-click Exceptions and select Add.
  2. Configure the properties from teh table shown below.
  3. Click Save. The exception will be available in the flow for handling errors.

Conclusion​

Creating a Server Flow is a structured process that involves:

  • Setting up the flow in a categorized folder.
  • Defining input/output parameters.
  • Handling exceptions.
  • Designing logic using constructs.
  • Testing and deploying the flow for execution.

Designing the Server Flow Logic​

  • Use constructs such as If, Switch, Call REST API, Run Query, etc., to build logic.
  • Configure each construct according to the flow's purpose.
  • Click Save once the flow is designed.

Server Flow Constructs​

Constructs in Server Flow define how operations are executed, allowing users to design backend workflows with logic control, API calls, database interactions, and error handling. Below is a categorized list of constructs available in a Server Flow.

1. Control Flow Constructs (Logic & Looping)​

These constructs help control the execution flow within a Server Flow.

  • If → Executes a block of logic based on a condition.
  • Switch → Evaluates multiple conditions and executes the matching case.
  • While → Runs a loop as long as a condition remains true.
  • Foreach → Iterates over a collection or list of items.
  • Continue → Skips the remaining logic in a loop iteration and moves to the next cycle.
  • Return → Exits the Server Flow and optionally returns a value.

2. API & Integration Constructs​

Used to call external or internal APIs and handle integration.

  • Call REST API → Sends HTTP requests (GET, POST, PUT, DELETE) to external or internal APIs.
  • Call Dynamic API → Calls an API dynamically based on runtime conditions.
  • Call Workflow → Triggers another workflow inside the server flow.
  • Terminate Workflow → Stops an ongoing workflow execution.
  • Get Workflow Result → Retrieves the output of a previously executed workflow.

3. Database & Transaction Management​

Handles database queries and ensures data consistency.

  • Run Query → Executes a database query (SELECT, INSERT, UPDATE, DELETE).
  • Query Output Mapping → Maps database query results to parameters or variables.
  • Begin Transaction → Starts a database transaction.
  • Complete Transaction → Commits or rolls back a transaction.

4. Exception Handling Constructs​

Ensures error handling and prevents crashes.

  • Raise Exception → Triggers an error to stop execution and return a meaningful response.

5. Data Handling Constructs​

Helps in processing JSON, XML, and object creation.

  • Create Anonymous Object → Creates an object dynamically at runtime.
  • Create Object → Defines and initializes an object.
  • Json Parse → Converts a JSON string into a structured object.
  • JSON Search → Searches for specific keys/values within a JSON structure.
  • Convert JSON to XML → Converts JSON-formatted data to XML format.
  • Convert XML to JSON → Converts XML-formatted data to JSON format.
  • Run Liquid Transformation → Processes data transformation using Liquid templating.

6. File Downloads​

Used for downloading files.

  • Prepare File Content → Used to send the contents of a binary file to the response.

7. Event & Task Management​

Handles event-driven workflows and background tasks.

  • Raise Event → Triggers a signal for a workflow pending on an external event to resume execution.
  • WhenAny → Waits for any one of the supplied activities (tasks) to complete before proceeding.
  • WhenAll → Waits for all the supplied activities (tasks) to complete before proceeding.
  • Run Background Task → Executes a task asynchronously on a background thread without blocking the main flow.

8. Code Execution & Utility Constructs​

Allows custom code execution and logging.

  • C# Snippet → Insert custom C# code directly in the Server Flow.
  • Call Library Function → Calls a function from an existing external library.
  • Log → Captures and records logs for debugging and monitoring.

9. HTTP Status Management​

Override the default http status codes (200/403/500).

  • HTTP Status Codes → Sets specific HTTP response codes for API endpoints (e.g., 202 Accepted, 403 Forbidden, 308 Permanent Redirect).