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:
Configuring the Callable Journey trigger
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.
No authorization is required since this is an internal app of Quickwork.
In the Name field, specify the name of the journey. E.g., Callable-Login API.
Select Request type and Response type as application/json.
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":""
}
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":""
}
Configuring the Databases by Quickwork action
Click on the Simple Action button and choose the Databases by Quickwork app from the drop-down list.
Choose the Search record action from the Actions list.
No authorization is required as this is the internal app of Quickwork.
Select the Employee login details for the Collection ID input field.
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:
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:
The If Else Condition block will appear with the pre-indented action bars as illustrated here:
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.
Configuring Callable Journey action under If Condition
Click the Please choose an action bar. Choose the Callable Journey app from the drop-down menu in the App field.
Select the action, Return Response, from the drop-down menu in the Action field.
Select Success in the Response type drop-down menu field and type true in the Status field:
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:
Click the Please choose an action bar. Choose the Callable Journey app from the drop-down menu in the App field.
Select the action, Return Response, from the drop-down menu in the Action field.
Select Success in the Response type drop-down menu field and type false in the Status field:
Once all the configuration is done, the journey must look like this:
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.
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 IfrecordFoundis true: