API

The API section of vFlow 2.0 enables the creation of API instances that connect with the integrated APIs from vConnect. This facilitates communication between the application and servers, allowing it to fetch or send data as needed.

Common Uses:

  1. Displaying Data:
    • It fetches data from servers and displays it on the application page, such as user details or account balances.
  2. Capturing Data:
    • It captures and sends data entered by users on the application page to the server for processing or storage.
  3. Validating Inputs:
    • It verifies sensitive inputs such as passwords or OTPs against server-side validations for enhanced security.
  4. Sending Notifications:
    • It sends OTPs or other notification messages to users for authentication or informational purposes.
  5. API Chaining:
    • It invokes or call another API within workflows, enabling complex interactions between multiple services or data sources.

Steps to Connect to an API in vFlow 2.0

  1. Access the Configurator Page
    • Put your mouse on the left panel on the vFlow 2.0 Configurator page.
    • The Configurator menu will expand.
  2. Navigate to the APIs Section
    • As the menu opens, click APIs.
  1. Create an API
    • On the top of the APIs page, click + Create ().
    • The “Create API” dialog box will open.
    • Enter the Name, select the Type of API, and click Create.

Configuring an API Instance

Creating an API instance in vFlow 2.0 involves defining the request and response configurations. Follow the steps below for a seamless setup.

Define Request and Response

Request: This section configures the request your application will send to the server.

  1. Headers: The fields for Key, Source, and Value are predefined and cannot be edited.
  2. Body: You can define an object in JSON format.
    • Steps to Add:
      • Click the + Add Object button in the middle of the page.
      • A dialog box with a gray background will appear. Define the object in JSON format.

      • Click Save to save the object.

Note: Ensure the JSON structure matches the specifications defined in vConnect.

Response: This section defines how your application handles and displays the server’s response.

  1. Complete: Enter the full path where the response data will be saved or displayed. Use this for displaying data in a single component or page.
  2. Define Object: Add JSON paths for saving or displaying data across multiple components or pages.
    • Steps to Add:
      • Click the + Add Object button in the middle of the page.
      • A dialog box with a gray background will appear. Define the object in JSON format.

      • Click Save to save the object.

Note: Ensure the JSON structure aligns with vConnect specifications.

Selecting Keys and Values

After defining the body of the object, you can choose the key-value pairs required for the request or response.

Example:
If the JSON body contains:
{
“name”: “ajay”,
“age” : 1
}

  • After saving the changes, you can select name or age using tick boxes to specify the keys for the request or response.. You can also define its value.
  1. Review and Save
    • Click the “Review & Save ()” button to open the review window.
    • After reviewing, click the Save button.
  2. Commit Changes
    • Then you return to the Vflow Configurator page, where you commit the changes.
  1. Using the Configured API
    • The API can now be utilized through the Data section of components or pages.
    • You can also create an API task to trigger in events like onClick or onSelect.

Note: To know more about Data, click here, and to learn how to configure API in the vConnect, visit posts under the Integration category.

Was this article helpful?
YesNo