Quickwork
Search…
⌃K

A journey for API Management implementation

Understand what type of workflows undergo API creation with an amazing illustration of a Callable Journey example. API Management creats an API for a workflow having Callable Journey as a trigger.
To understand the functioning of API Management, it is mandatory to have a Callable Journey executing in the Quickwork platform.

Use case

Create an API for a user(s) logging into the Quickwork platform.
  • Trigger: Callable Journey-New call
  • Condition: If Else
  • Actions: Databases by Quickwork-Search record, Callable Journey-Return response
It is mandatory for a journey to have Callable Journey-New call as a trigger and Callable Journey-Return response as the last action step to create an API using API Management.

Prerequisites

Create a collection named Employee login details in Databases of the Quickwork platform. Enrich the collection with the employee records containing name, ID, and password:
Figure 1: Employee login details collection in Databases

Configuring the Callable Journey trigger

  1. 1.
    Under the Event section, search for the Callable Journey app and click on it. Then select the trigger event, New call, from the Triggers list.
  2. 2.
    No authorization is required since this is an internal app of Quickwork.
  3. 3.
    In the Name field, specify the name of the journey. E.g., Callable-Login API.
  4. 4.
    Select Request type and Response type as application/json.
  5. 5.
    Specify the input in the JSON format in the Input field. The input must contain a sample key-value pair as per the columns defined in the Employee login details collection:
    {
    "Name":"",
    "Login":"",
    "Password":""
    }
  6. 6.
    In the Output block, specify the sample response in the JSON format. The value defined here becomes the response and can be seen in the Return response action of Callable Journey. E.g.,
    {
    "Status":""
    }
Figure 2: The New call trigger

Configuring the Databases by Quickwork action

  1. 1.
    Click on the Simple Action button and choose the Databases by Quickwork app from the drop-down list.
  2. 2.
    Choose the Search record action from the Actions list.
  3. 3.
    No authorization is required as this is the internal app of Quickwork.
  4. 4.
    Select the Employee login details for the Collection ID input field.
  5. 5.
    Now, drag and drop the appropriate data pills from the Callable Journey | New call Trigger Data Output Tree in the Employee name, ID, and Password field, respectively:
Figure 3: Configuring Databases by Quickwork-Search record action

Configuring the If Else condition

Now, let's use the If Else Condition to validate the user trying to log into Quickwork. Under the Steps section, click the Add a new step button (+ icon) and, click the Business Logic option. Then select the If Else Condition:
Figure 4: The IF Else Condition
The If Else Condition block will appear with the pre-indented action bars as illustrated here:
Figure 5: The If Else Condition

Configuring the If Condition block

Let us validate and return true as a response when a user logs in to Quickwork with a valid ID and password.
In the Left Value field, pass the
data pill by clicking from the Databases by Quickwork | Search record step under Data Tree Output. Select the Is true condition from the drop-down menu in the Condition field. Once successfully done, your If Condition block will look like the following screenshot with a heading If recordFound is true:
Figure 6: The If Condition block

Configuring Callable Journey action under If Condition

  1. 1.
    Click the Please choose an action bar. Choose the Callable Journey app from the drop-down menu in the App field.
  2. 2.
    Select the action, Return Response, from the drop-down menu in the Action field.
  3. 3.
    Select Success in the Response type drop-down menu field and type true in the Status field:
Figure 7: Callable Journey under the If Condition block

Configuring Callable Journey under Else block

Now, let us validate and return false as a response when a user logs in to Quickwork with an invalid ID and password. Configure Callable Journey under the Else block to do so:
  1. 1.
    Click the Please choose an action bar. Choose the Callable Journey app from the drop-down menu in the App field.
  2. 2.
    Select the action, Return Response, from the drop-down menu in the Action field.
  3. 3.
    Select Success in the Response type drop-down menu field and type false in the Status field:
Figure 8: Callable Journey under the Else block
Once all the configuration is done, the journey must look like this:
Figure 9: Callable-Login API
Save the changes of the journey and click the Save & Start button.
This journey only executes when the trigger listens to a new call initiated via API. Read the next document to understand how to create an API for this journey and call it to execute the journey.