Actions

Actions

Actions

Actions allow you to make API calls using values from a record and/or with user-provided inputs
image

Once you’ve defined an action, you and your team can make API calls by providing values to the inputs and submitting them to be run via a button click.

Overview

Basedash started out as way to talk to SQL databases. Now, with Actions, Basedash can talk to servers too.

  • Actions can be created by admins, and can be run by admins, creators, and editors.
  • An action can make an API call to an endpoint.
  • An action can take, and be run with, user-defined inputs. The values can be pre-filled with values from a record within a view or can be manually specified at the time of running the action.
  • Actions can interpolate values via curly bracket syntax {{ }} in order to modify the action’s URL, API headers, or body
  • An action can be associated with a Basedash view which allows for the action to be run on record from the view and have the record’s values available for interpolation.
⚠️
Caution Actions execute Web requests with user-provided input targeting your own server, or a 3rd party server. It is important to ensure only trusted parties maintain and use the actions you create.

Add an API connection

🔒
You must be an admin to add an API connection

Actions act on APIs, so you will first need to add an API before you can create an action.

Navigate to the “new connections” page to add a new API connection. You can pick from one of the API templates or setup a custom API connection to communicate to another third party service.

image

An API connection consists of:

  • A name
  • A base URL, e.g. https://www.example.com/api
  • Zero or more request headers, e.g. Authorization Bearer 12345678-9876-pretend-example-token
The request headers you define for an API connection end up being sent with all actions using that API.

Once an API connection is added, you can setup multiple actions that each define a path to a specific endpoint on that API.

For example, if the API's base URL is https://www.example.com/api, and if the Action's URL path is /widgets/go then you end up with them being joined together into a full URL like so: https://www.example.com/api/widgets/go

Create an action

🔒
You must be an admin or creator to create or update an action

Creating a new action page can be done from the sidebar. Once created, you will be within the action editor which will look like this:

image

Name: A short descriptive name for your action.

View: Optionally, choose a view page to associate with your action. This will allow your to run your action on a record from your view and prefill values within your action with values from the record, using variable interpolation (e.g. {{ User.fullName }}).

Type: HTTP request type (POSTGET, etc.)

URL suffix: This will be appended to the API connection’s base URL to create the full action URL. Variable interpolation is available on the action’s URL path.

Button text: Text on the button used to run an action.

Description: Provide more details on the purpose of the action and how it should be used. Can include links in the description (e.g. to your own documentation, or to documentation about the endpoint) and they will be rendered as links when previewing the action.

User inputs: Define one or more User inputs. These inputs can then be used via variable interpolation in the action’s

  1. Provide a Label for the input
  2. The Identifier will be automatically generated based on the Label. Used for variable interpolation.
  3. Choose a Type for the input (text or textarea)
  4. Optionally provide some a default value, which will be used to prefill the input for the user going to run the Action. Can interpolate values from a linked view’s attributes (e.g. {{ User.fullName }}) in order to use a view’s record values to determine what to send through an action’s API call.
  5. Optionally provide some helper text which will be displayed adjacent to the given input for the user going to run the Action
image

Headers: Define one or more Headers. These headers will be sent in addition to the API connection headers.

  1. Provide a Name for the header
  2. Provide a Value for the header. Variable interpolation allowed.

Body: The body that will be sent as the payload of the API call. Variable interpolation allowed.

Run the Action

🔒
You must be an admin, creator, or editor to run an action

Actions can be found in the main app sidebar and, if the action is linked to a view, it is made available from the record details panel when a record is selected on a view.

image

Here is a look at an action page.

image

You can fill out the inputs manually and then click the button to run the action.

Here’s an example of how values can be pre-filled when running an action on a record within a view:

image

After running the action, you will see the response in the bottom right corner of the window indicating if the action ran successfully.

💠
https://www.basedash.com

© BaseDash Inc.