Configure Service
The Configure Service task is used to configure and consume an API through the API widget. When the Configure Service task executes, it invokes an API. When an API is invoked, it performs a specific function. The API can be consumed for several purposes as follows:
- Storing data in the database
- Fetching data from the database and then display it to the end-user
- Sending OTP to the user
- Password and OTP verification
- Data manipulation and others
Note:- To apply the Configure Service task, the vDesigner app must be connected to the Vahana middleware. Otherwise, you will not be able to configure the API.
Steps to Configure
- On the <<task group’s name>> page, find the Task panel.
- In the Task panel, search and find the Configure Service task.
- Drag the Configure Service task from the Task panel to the Execution panel.
- Under Configure Service, a group of boxes comes into view.
- In the boxes, configure related properties as follows:
List/Box | Description |
Reference Name | In this box, enter the name of the task. Also, the system generates a reference name by default that you can change. |
Services | In this box, you can configure the following parameters: –> Request Parameters –> Response Parameters To configure the request and response parameters, you can perform any of the following activities: –> You can select a pre-configured API and then map its parameters –> You can navigate to the vConnect portal to create a new API To create a new API by using the vConnect portal, you can visit the post on the vConnect portal. To map the parameters of an earlier configured API, see the followig heading section: Setting Parameters. |
Setting Parameters
In the vDesigner module, configuring a service includes three following activities:
- Consuming a service/API
- Setting Request Parameters
- Setting Response Parameters
These three functions are broadly described as below:
Consuming API/Service
- In the Configure Service task, see the Service box.
- In the Service box, click the application tree icon (
), and the right panel displays the Services area.
- In the Services area, see multiple services.
Note:- The Services panel displays the services that you have configured and deployed on the vConnect portal.
- In the Services area, click a service that you want to configure, and the Info panel opens.
![](https://academy.vahanacloud.com/wp-content/uploads/2023/01/image-8.png)
- The Info panel displays the service’s details.
- In the Info panel, click Consume, and the Services panel displays the following sections:
- Request Parameters
- Response Parameters
After you consume the service, you need to configure the request parameters. The next section describes how to configure the request parameters.
Setting Request Parameters
- In the Services panel, under Request Parameters, click the Body tab.
- Under the Body tab, click Add Object, and the Add: Json Object dialog box opens.
![](https://academy.vahanacloud.com/wp-content/uploads/2023/01/image-9.png)
- In the Add: Json Object dialog box, enter or paste the JSON code of the body parameters.
- After you enter or paste the JSON code, click Save, and the Services panel displays a tree.
- The tree displays the list of body parameters.
![](https://academy.vahanacloud.com/wp-content/uploads/2023/01/image-10.png)
- In the list, click one or more check boxes to select the corresponding parameters (for example:- CustomerName or CustomerNumber that you want to configure, and the Service panel displays two columns:
- Key Name:– It contains the name of the selected parameters
- Value:- It contains the smart selector.
![](https://academy.vahanacloud.com/wp-content/uploads/2023/03/image-23.png)
- Click in the smart selector, a list expands.
- The list contains the followings:
- Elements (Reference name of elements)
- Attributes
- Functions
- In the list:
- Select the element (element’s reference name) if you want the parameter to pick the value from the element.
- Select an attribute if you want the parameter to pick the value from the selected attribute.
- Select a function if you want the parameter to fetch a computed value
- Select the “Static” function if you want the parameter to pick a static value
- To configure other request parameters, repeat the steps 6 and 9.
After you configure the request parameters, you need to configure the response parameters.
Setting Response Parameters
- After you configure the request parameters, click Next, and the Services panel displays the Response Parameters area.
- In the Response Parameters area, you can configure the response parameters as follows:
Case1:- (If you want to display or store a complete output that the API returns)
- In the Response Parameters area, click the Complete tab, and a smart selector appears.
![](https://academy.vahanacloud.com/wp-content/uploads/2023/03/image-24.png)
- In the list, you can select one of the followings:
- Element (Reference name of the element):- Select an element if you want to display the output in the element.
- Attribute:- Select an attribute if you want to store the output in the JSON-based attribute.
Case2:- (If you want to display or store a specific part of the output)
- In the Response Parameters area, click the Define Object tab.
- Click Add Object, and the Add: Json Object dialog box opens.
![](https://academy.vahanacloud.com/wp-content/uploads/2023/03/image-26.png)
- In the Add: Json Object dialog box, enter or paste the API’s response code, and then click Save, and the Response Parameters area displays the list of response parameters.
- In the list, click the corresponding check box to select one or more parameters, and a panel displays two columns:
- Key:- It displays the name of the selected parameters.
- Value:- It displays the smart selectors.
- To configure the selected parameters, click in the smart selector and then select one of the followings:
- Select the element (element’s reference name) if you want the parameter to display the value in the element.
- Select the attribute if you want the parameter to store the output in a specific JSON based attribute.
- Repeat the step 10 to configure all response parameters.
- After you configure the request and response parameters, click Review and Save, and a dialog box opens and displays the list of request and response parameters that you have configured.
- After you ensure that you have configured parameters correctly, click Save to configure the Configure Service task.