Quick Start - REST API
This guide introduces building an internal management interface for a company, implementing the following functionalities:
- Display a list of users in a table.
- Retrieve and select notification templates from a list.
- Display the title and content of the selected template in a select.
- Send the selected template notification to the chosen user.
Data Integration
We will be using [Onboarding RestAPI] which is already connected, so no setup for connection is required.
If you need to connect your own data source, please see here.
Displaying a List of Users in a Table
- Drag & drop [Text] from the right [Components] onto the canvas.
- Enter
User List
in [Text] on the right [Inspect]. - Drag & drop [Table] from the right [Components] below the [Text] you placed.
- Click [Create] in [Dataflows].
- Change the dataflow name to
listUsers
. - Select [Onboarding RestAPI].
- Enter
/v1/users
in [Path]. - Click [Run].
- Select the [Table] and enter
{{ listUsers.data.users }}
in [Data] in the [Inspect].
Retrieving and Selecting Notification Templates
- Drag & drop [Column] onto the canvas from the right [Components].
- Place the already existing [Table] on the left side of the [Column], and place [Select], [Input], [Text Area], and [Button] on the right side.
- Enter
Select Template
,Title
,Notification Content
,Send
in the [Label] of each [Select], [Input], [Text Area], and [Button] respectively in the [Inspect]. - Click [Create] in [Dataflows].
- Change the dataflow name to
listTemplates
. - Select [Onboarding RestAPI].
- Enter
/v1/templates
in [Path]. - Click [Run].
- Open the [Inspect] of [Select] and enter
{{ listTemplates.data.templates.map(d => d.id) }}
in [Values] and{{ listTemplates.data.templates.map(d => d.name) }}
in [Labels]. - Enter
{{ listTemplates.data.templates[0].id }}
in [Default value].
Displaying Selected Template's Title and Notification Content
- Click [Create] in [Dataflows].
- Change the dataflow name to
getTemplate
. - Select [Onboarding RestAPI].
- Enter
/v1/templates/{{ select1.value ? select1.value : 1 }}
in [Path]. - Click [Run].
- Click [input1], and in the [Inspect], enter
{{ getTemplate.data.title }}
in [Default value]. - Click [textarea1], and in the [Inspect], enter
{{ getTemplate.data.body }}
in [Default value]. - Check [Run automatically on inputs change] for [getTemplate].
Sending Selected Template Notification to a Chosen User
- Click [Create] in [Dataflows].
- Change the dataflow name to
sendNotice
. - Select [Onboarding RestAPI].
- Select
POST
in [Method] and enter/v1/notices/send
in [Path]. - Write the following JSON in [Data]:
{
"title": {{ input1.value }},
"body": {{ textarea1.value }},
"userId": {{ table1.selectedRow.data.id }}
}
- Select [button1], click [Add Event] in the [Inspect].
- Select
sendNotice
in [Dataflow]. - Confirm that the notification is sent to the user selected from the table with the content from the selected notification.