API Flow Examples

These flows can be viewed from Saga screen in Devops app, grouped under training domain

All API workflows can be accessed via DevOps → Saga in the admin UI. In that screen, you’ll find the flows listed below under the “training” group.

Training Sagas

Saga: /train_ping

This is the smallest end-to-end flow in the training domain. It wires a Start step straight to a Success step. It then echoes the incoming request payload back in the response. Use it as a smoke test for routing, authentication, and payload shape.

Ping Flow

Saga: /train_hello

This flow adds a single transformation step to the basic ping pattern. It generates a deterministic output message, like "Hello World", regardless of input. It is useful for learning how transform outputs become HTTP responses. It also helps confirm response mapping without touching any state.

Hello Flow

Saga: /train_redirect

This flow demonstrates redirecting one endpoint to another saga. It reuses train_hello without defining its own step graph. That pattern keeps multiple endpoints consistent, while avoiding duplicate logic. It is also handy for deprecations and versioned routes.

Redirect Mapping

Saga: /train_condition

This flow shows how branching works in sagas. A condition is evaluated and step links route execution to Success or Fail. It is a good template for validation or eligibility checks. Use the pattern when you need explicit “happy path” and “rejection path” responses.

Condition Flow

Saga: /train_get

This flow demonstrates a read operation against a state manager. It calls a local read handler to fetch a dummy record by id. The response payload is built from the record returned by the handler. Use it to understand how saga inputs map to state reads.

Get Flow

Saga: /train_set

This flow demonstrates a write operation against a state manager. It calls a local write handler to create or update a record in the dummy state manager. The request payload becomes the write input, with IDs and fields mapped by parameters. Use it as a baseline for POST/PUT style endpoints.

Set Flow

Saga: /train_query

This flow demonstrates server-side filtering with a reusable query definition. It calls a local query handler and executes the "Dummy Search" query. The query filters records by fields such as name and returns a list. Use it to learn how query parameters travel from API input to the query engine.

Query Flow

The query is accessible from the Query screen of the Configuration application. This is where the stored query text and parameters live. Updating it changes this endpoint’s behavior without editing the saga.

Dummy Search Query

Saga: /train_rest

This flow demonstrates an outbound HTTP call from a saga. It uses the REST handler together with a configured System definition. The saga builds a request, sends a GET call to the remote system, then forwards the response. Use it for simple integrations and for validating network access from runners.

Rest Flow

This flow is also used in AI Agent example, and includes a simple input schema, which allows the AI agent to make calls to this flow in the correct data pattern. It also includes some optional instructions and mappings for the agent in AI tab.

Saga: /train_pattern

This flow builds on train_rest by parameterizing request and response mapping. It uses patterns in event metadata to inject values into the outbound request. It can also extract and reshape fields from the remote response into a clean API output. Use it when you need lightweight mapping without custom code.

Pattern Parameters

Saga: /train_secret

This flow demonstrates basic crypto utilities in a saga. It encrypts an input value using a preconfigured key. It then decrypts the value back and returns it for verification. Use it to understand how secrets and encryption helpers fit into API flows.

Secret Flow

Saga: /train_script

This flow executes a stored Groovy script from within the saga. The script reads parameters from the incoming payload. It then returns a computed payload, often echoing or reshaping inputs. Use it for fast prototyping when a transform step is not enough.

Script Flow

The script itself is configured using the code editor accessible in Configuration application.

Executed Groovy Script

Saga: /train_template

This flow renders a text output using a stored Handlebars template. It passes inputs like name and surname into the template context. The rendered string is returned as the API response, which is useful for emails or HTML snippets. Use it to learn template parameter binding and output formatting.

Template Flow

The template itself is configured using the code editor accessible in Configuration application.

Rendered Handlebars Template

Saga: /train_hft

This flow demonstrates dynamic Java compilation and execution at runtime. It loads a Java class definition from stored configuration. It compiles the class and runs it as an event handler during the saga. Use it for advanced experiments, where you need real code without redeploying.

HFT Flow

The class itself is configured using the code editor accessible in Configuration application.

Dynamic Java Class

Saga: /train_rule

This flow evaluates a list of rules against the incoming payload. It returns the selected outcome value after rule matching. It is a good template for pricing, routing, or classification decisions. Use it to see how business rules can be changed without code changes.

Simple Rule Flow

The rule list for calculation is configured using the rule records accessible in Configuration application.

Rule Configuration

Saga: /train_mock

This flow returns a fixed example response without calling any backend. It is intended for mocking endpoints during UI or integration development. You can keep contract tests moving while the real logic is not ready. Later you can swap the mock for real steps without changing the route.

Mocking Configuration

Saga: /train_for

This flow demonstrates looping over a list in the payload. It runs the same action for each item, such as rendering a template per entry. It typically produces an aggregated output list or concatenated result. Use it when you need per-item enrichment without writing code.

Saga: /train_parallel

This flow demonstrates fan-out execution. It triggers two independent branches at the same time. It then continues once both branches complete, typically combining their outputs. Use it to reduce latency when you call multiple systems.

Saga: /train_nested

This flow calls another saga from within a parent saga. It passes a payload into the nested saga and receives its output. This is the main reuse mechanism for shared business logic. Use it to keep complex flows modular and easier to test.

Last updated