Configure an API Task in a form

Create and configure a form to invoke the API Task and map the API Task variables to the required fields in the form.

Prerequisites

  • You must have a Bot Creator license.
  • You must first create an API Task to invoke it in the form.
This topic describes how to invoke an API Task in a form. In this example, you will create a ZIP code form that invokes an API Task to retrieve the place and state details based on the ZIP code input provided. The form created is executed through a process. You can create a form with the fields that are specific to your use case.

Procedure

  1. Navigate to an existing form or create a new form where you want to invoke an API Task. For more details, see Create a form.
    Name this form as API Task - ZIP Code Form.
  2. Design a Form: Use the form elements to construct an interactive form based on your use case. In this example, the form is designed for mapping the ZIP code variables from the API Task.
    1. From the Elements column, drag the Text Box element and drop it into your form designer.
      The Properties tab appears with the relevant fields on the right side of the screen.
    2. Enter an Element label. For example: Zip code.
    3. Drag the Button element and drop it the designer below the Zip code text box. Enter a name for this button in the Button-text (required) field as Submit.
    4. Additionally, drag two more Text Box elements and name them Place and State.
  3. Add the Form rules. Form rules provide the conditions required for each element in the form. You can set form rules using the if and then conditions and specify the actions that will be executed when the conditions are met. In this example, the form rules are configured so that when a Zip code is entered and Submit button is pressed, the place and state element box will retrieve the values from the API Task variables. During execution, the API Task will not perform as expected if the form rule conditions are not satisfied.
    1. Click the Form rules tab.
    2. If desired, enter a name for the rule. (For example, API Task call).
    3. Enter an If condition to validate if the button is pressed.Invoke an API Task in form
    4. To define the Then clause, select Form actions and then from the drop-down, select Get value from API call.
    5. You can map variables associated to the API Task to a form using the Add variable mapping option.
      Note: If you edit a published API Task and add additional variables after you have checked the task in, the variables will not display in the form. You must check-in the API Task after adding the variables.
    6. Click Browse to select a specific API Task to perform a specified operation. In this example, an API Task (API Task - Zip Code ) is selected to retrieve the Place and State of any Zipcode.