This lesson will cover the following topics:

02 | Setup

01 Getting Started

This tutorial covers using the custom API node in Titan flow to invoke a REST API.

02 Setup

For our example, we will call a weather API and return the results to a web project. This includes a static variable with the label: result.

Screenshot of the example project

03 Static Variables

A static variable was created to hold two values, one for the API result and the other for the city the user selects in the web project.

Custom variables window showing the static variables tab

04 Custom API Node

1. Click the Any + icon, choose Custom API as the node, and click Next.

Adding a Custom API node

2. Provide the details for your API and click Next.

Step 1 of configuring custom api

3. Add any parameters you may require. For our example, we required two according to our app. Click Next.

Step 2 of configuring a custom API action

For our example, we did not require step 3. If you do require this step for your API, simple set your headers using the provided fields.

4. Use the Add Param icon to add required parameters to your node. For our example, we want to map part of the API result to the static variable.

Step 4 of configuring a custom api action

5. Enter a Tag name and click Insert.

6. Click the Custom API + icon, choose Finish as the node, and click Next.

Adding a finish node to the flow

7. Enable the api_result variable and click Next.

Configuring the finish node

8. Enter a Tag name and click Insert.

Save and publish your flow.

05 Invoking the Flow

1. Navigate back to your web project.

2. Click the Interactivity icon from the button menu.

Button menu interactivity icon

3. Click the Start + icon, choose the Flow node, and click Next.

Choosing the flow node as the on click action

4. Use the dropdown to select the Rest API Flow. 

5. Disable Run in Background.

6. Click Configure Parameters.

Configuring the flow node

7. Configure the input_city as the City text input field. Click Apply.

Configuring parameters window

8. Click Return Parameters.

9. Map the result variable to the field api_result. Click Apply.

configure return parameters window

10. Click Next, enter a Tag name, and click Insert.

When the user provides a city name and invokes the flow. The result will display in the field.

Screenshot showing how the invoked flow displays the API results

06 Got Feedback?