This part of the tutorial series explains how to use the users_badges table to create relationships between users and their badges.
- In the Explorer pane, click Create new.
- Select API.
- Type Add badge to user.
- Tap the Return key.
- Open the Start component.
- From the Method dropdown, select POST.
- In the URL field, enter /add-badge.
- Create the following query string parameters: userId and badgeId.
Add an Upsert component to the flow. This component creates a record if it doesn't already exist. If the record does exist, it updates it. This ensures that we never create more than one relationship between the same user and badge.
From the Table dropdown, select users_badges.
Configure the component with the following columns:
Column Value Key userId
- Add an End component to the flow.
- From the Status Code dropdown, select 200 OK.
- From the Content Type dropdown, select application/json.
- In the Body field, enter
This is what the complete flow looks like:
Updated about 2 months ago