Creating levels

The next chunk of work is to create the project's levels feature. All users will have a level and, as they reach certain point thresholds, their level will increase.

Step 1: Set up the database table

  1. In the Explorer pane, click Create new.

  2. Select New Table.

  3. Type levels.

  4. Tap the Return key.

  5. Switch to the Configuration tab.

  6. Create the following columns:

    NameData TypeNullableReference

    The Reference data type is unique to FL0. It lets us create relationships between records in separate database tables. In this case, we're ensuring that levels are associated with a badge, so that when a user moves to the next level, they receive a badge.

  7. Click Save.

Step 2: Create an "API" flow

  1. In the Explorer pane, click Create new.
  2. Select API.
  3. Type Insert level.
  4. Tap the Return key.

Step 3: Configure the "Start" component

  1. Open the Start component.

  2. From the Method dropdown, select POST.

  3. In the URL field, enter /levels.

  4. From the Input Type dropdown, select Json.

  5. Copy the following JSON Schema into the Input Schema field:

      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        "min": {
          "type": "number"
        "max": {
          "type": "number"
        "badgeid": {
          "type": "guid"
        "level": {
          "type": "number"
      "items": null

    This schema defines the shape of the data that can be received in the request body.

Step 4: Insert the level into the database

  1. Add an Insert component to the flow.

  2. Rename the component to insertLevel.

  3. From the Table dropdown, select levels.

  4. Configure the component with the following columns:


Step 5: Create the HTTP response

  1. Add an End component to the flow.
  2. From the Status Code dropdown, select 200 OK.
  3. From the Content Type dropdown, select filePath.
  4. In the Body field, enter

This is what the complete flow looks like: