Build a Workflow v2
Build a Workflow that finds the name of the driver who came first in the first race of a year you choose. The Workflow returns the driver's family name, such as Verstappen for 2024.
This article explains how to build a Workflow by hand. You can also build using AI - either by using the built-in AI assistant or by connecting Flowgear Builder MCP Server to your own agent.
You will use two OpenAPI REST Request Steps: one to get the season schedule and one to fetch the first race's results. Along the way, you will configure a Connection, drag Flow Connectors to map data, use FIRST to select values, inspect real responses, and save a revision.
Before you start
You need access to a Site and permission to create Connections and design Workflows. This example uses the public Jolpica F1 API. The schedule and results requests used here are free and work without an account, API key, or authentication.
Use the Site's Test Environment. The Save action is available in the first-ranked Test Environment, where the latest design is maintained. The reference example uses OpenAPI REST Request version 0.0.0.18.
Create the Jolpica Connection
A Connection stores the settings a Node uses to access another system. An OpenAPI definition describes the API's operations and data shapes so the designer can offer them as Templates.
- Open
Connectionsfrom the main navigation and clickNew v2 Connection. - Enter
Jolpica F1inConnection name. - Select the
OpenAPI REST RequestNode in theNodefield. - Select the Test Environment and keep the Cluster set to
Cloud Cluster. - Enter
https://api.jolpi.cainUrl. - Enter
https://api.jolpi.ca/docs/schemainOpenApiUrl. - Keep
Authorizationset toNoneand leaveCustomHeadersempty. - Click
Acquire Metadatato load the API definition, then clickSave changes.
Only the base URL and OpenAPI URL need to be supplied for this example. Acquiring metadata makes the API operations available when you add a Step.
Create a Workflow
- Open
Workflowsfrom the main navigation. - Open the folder where you want to create the Workflow. Stay at the root if you do not need a folder.
- Click
New Workflow. - Click the generated Workflow name in the top bar.
- Enter
Grand Prix podium finder, then click ✓.
Renaming changes the current design. It is recorded when you save the Workflow.
Add the Year Parameter
A Workflow Parameter lets you change the year without editing the Steps that use it.
- Open the
...menu on the WorkflowParameterscard and selectEdit Properties. - Click the
+control labelledAdd Property. Rename the new Property toYearand set its type tonumber. - Click
Applyto finish editing the Properties. - Select
Yearand enter2024as its Value.
This is the default year for the example. Property names are case-sensitive.
Get the season schedule
The results API identifies each race by an internal round ID. Start with the season schedule so you can select the first race's ID.
- Click the
+control on the canvas to openAdd step. - Search for and select
OpenAPI REST Request, then select theQueryMethod. - Select your
Jolpica F1Connection. - Select the
Alpha - Get Detailed F1 Season ScheduleTemplate. - Open the new Step's
...menu, selectRename Step, and name itgetSchedule. - Expand
getSchedule.Options, then drag a Flow Connector fromParameters.YeartogetSchedule.Options.year.
To create the Flow Connector, press and hold the connector point on the edge of the Parameters.Year row. Drag it to getSchedule.Options.year, then release. The designer draws the Flow Connector and creates the mapping.
- Confirm that the Test Environment and
Cloudare selected, then clickRun. - Wait for the run to complete and select the
getScheduleentry inLogs. - Expand its
ResponseReturn, then inspectdata→events→round. Inspect the first event. For2024, its round name isBahrain Grand Prix; check that it also has anid.
The Template already exposes events, round, name, and id, so you can use them in the next mapping without inferring a schema.
Get the race results
- Click the
+control aftergetSchedule. - Select
OpenAPI REST Request→Queryand yourJolpica F1Connection. - Select the
Alpha - Get results for a roundTemplate. - Check that its
Optionscontainround_idandsession_filter. Jolpica also has a laps operation with the same Template name; if you seefull_session_code, remove that Step and select the other matching Template. - Rename the Step to
getResults. - Drag a Flow Connector from
getSchedule.ResponsetogetResults.Options. - Expand
Options, selectround_id, switch toExpression, and enter:
FIRST({getSchedule.Response.data.events.round.id})
Click ✓ to apply the Expression. The Flow Connector to getResults.Options makes the fields inside it use the current schedule response. FIRST then selects the first event's round ID, so the next request retrieves the opening race of the selected season.
- Select
session_filterand enterRas its Value to request the race results. - Click
Run, wait for completion, and open thegetResultslog entry. - Expand
Response→data. Inspectseason,round,circuit, andresults.
Response is an array containing the API's response object. Inside that object, data.results is another array containing the drivers' results. Keep this distinction when you build the Workflow Returns.
If the request fails after changing Year, inspect the schedule first. Choose a year whose opening race has finished and has results. If the Workflow does not start, open Problems, resolve the error at the reported path, and run again.
Inspect the response shape with Infer Schema
The results Template already exposes results.driver.family_name, so you can map the driver's family name without inferring a schema. After running, you can also use inference to inspect the shape of the data that actually passed through the Step.
- Return to
Canvasafter the run and log loading have completed. - Open the
getResultsStep's...menu and selectInfer from run data. - Expand the proposed
ResponseReturn. Review the fields, types, and samples underdata→results→driver. - Select the top-level
ResponseReturn and clickApplyif you want to include its inferred subtree, or clickCancelto keep the existing schema.
Inference uses recorded run data; it does not call the API again. Some fields can be present in the response without being expanded in the Template. For example, the Bahrain response contains starting-grid and fastest-lap details inside results.components. Infer and apply the schema before mapping those extra fields.
If a field you need is missing from the canvas, first check that it appears in the log, then infer the schema and apply the Response Return before continuing. A field absent from that run cannot be discovered. See Infer a Schema for more about reviewing inferred Properties.
Return the winning driver's family name
A Workflow Return makes the result available to a caller as well as in the logs. This Workflow has one Return, FamilyName, with type string.
- Open the
...menu on the WorkflowReturnscard and selectEdit Properties. - Add a Property named
FamilyNamewith typestring, then clickApply. - Expand
getResults.Response.data.results.driver, then drag a Flow Connector fromgetResults.Response.data.results.driver.family_nametoReturns.FamilyName. - Select
FamilyName, open itsExpression, and replace the generated mapping with:
FIRST(FIRST({getResults.Response.data.results.driver.family_name}))
Click ✓ to apply the Expression. Response and results are both arrays, so this uses FIRST twice: once to select the response's list of family names, then to select the first driver's family name. The first result is the race winner; you can check its position is 1 in the getResults log.
Run and check the winner
- Click
Runand wait for the Workflow to complete. - Inspect the Workflow Returns in
Logs. - Check the value of
FamilyName.
For 2024, the first race is the Bahrain Grand Prix. Max Verstappen came first, so the Workflow returns:
FamilyName: Verstappen
Change Year to another year whose opening race has finished, then run again. The Workflow retrieves that year's first race and returns its winner's family name. Restore Year to 2024 if you want to keep the original default.
Save the first revision
- Click
Savein the top bar. - In the
Manage revisionsview, enterFirst working versionas the optional commit message. - Click ✓ or press
Enter.
When validation and compilation succeed, saving records a revision when the design has changed and publishes the latest design to the Test Environment. A new Workflow is also enabled automatically in that Environment.
If the design can be saved but cannot be published, the Console warns you and reports the compilation problem under Problems. Correct the problem, then save again.
The status switch in the top-right corner should now show Enabled. Workflow status is Environment-specific. Changing this switch controls whether the Runtime can start the Workflow through published interfaces in the selected Environment; it does not replace saving the design.
What you learned
You have used the main authoring loop:
- Create a Connection and load an OpenAPI definition.
- Add API operations as Workflow Steps from Templates.
- Supply inputs through Workflow Parameters.
- Use
FIRSTto select the first race and its winning driver. - Drag Flow Connectors to map fields visually.
- Inspect real responses and infer missing fields before mapping them.
- Expose a single value through a Workflow Return, test different inputs, and save a revision.
Continue with Workflow YAML, Data Mapping, or the Workflow designer reference.
Complete reference YAML
This complete example finds the driver who came first in the first race of the selected year and returns their family name. It defaults Year to 2024 and includes only the response fields needed by the mappings. Use Infer from run data to add other fields before mapping them.
Connection keys belong to your Site, so the two Connection Values are deliberately left unset. Create the Jolpica F1 Connection and acquire its metadata as described above, then select it on both Steps after pasting.
- Open
Workflowsand clickNew Workflowto start with a blank design. - Select
Codein the bottom-right view selector. - Select all of the existing YAML and replace it with the complete block below, without the surrounding Markdown code fences.
- Switch back to
Canvasto see theYearParameter, two Steps, Flow Connectors, andFamilyNameReturn. - Select the
ConnectionParameter on each Step and choose yourJolpica F1Connection. - Confirm that the Test Environment and
Cloudare selected, then clickRun. - Inspect the results and save the revision. Use
Infer from run databefore extending the mappings to fields missing from the included schemas.
The Expression entries that contain only a field reference are how YAML stores visual Flow Connectors. When following the canvas walkthrough, create those connections by dragging. Edit Expressions when you need a function to transform or select data.
Name: Grand Prix podium finder
Parameters:
Year:
Type: number
Value: 2024
Steps:
- Name: getSchedule
Node: v2.OpenApiRestRequest@0.0.0.18
Method: Query
TemplateKey: 2f6de8fa-7157-566d-1cf6-65d64ec33acb
Parameters:
Connection:
Type: connectionKey
OperationId:
Type: string
Value: 2f6de8fa-7157-566d-1cf6-65d64ec33acb
Options:
Type: object
Properties:
year:
Type: string
Expression: '{.Year}'
Returns:
Response:
Type: array
Properties:
data:
Type: object
Properties:
events:
Type: array
Properties:
round:
Type: object
Properties:
id:
Type: string
- Name: getResults
Node: v2.OpenApiRestRequest@0.0.0.18
Method: Query
TemplateKey: 554db1e4-b388-ba71-f35d-fd57fa46b5c8
Parameters:
Connection:
Type: connectionKey
OperationId:
Type: string
Value: 554db1e4-b388-ba71-f35d-fd57fa46b5c8
Options:
Type: object
Expression: '{getSchedule.Response}'
Properties:
round_id:
Type: string
Expression: FIRST({getSchedule.Response.data.events.round.id})
session_filter:
Type: string
Value: R
Returns:
Response:
Type: array
Properties:
data:
Type: object
Properties:
results:
Type: array
Properties:
driver:
Type: object
Properties:
family_name:
Type: string
Returns:
FamilyName:
Type: string
Expression: FIRST(FIRST({getResults.Response.data.results.driver.family_name}))