10.37 REST API Chain and Hook Function
- REST API Chain: To understand what is chaining refer REST API Configuration section. This select box lists all the
REST API chaining that user have created in step four i.e. REST API Configuration.
From this select box, user can select REST API chain that user wants to fire when an
element is clicked.
- Hook function: There is a button named as “Open Editor”. When user
clicks this button, it will open a code editor as shown in the below image. In this
editor, user can write the code user wants to execute when the value of an element
is changed.
To understand more about editor refer Open Editor of hook function section
- User want to give an option to use a form as a template. It has an
input text to accept the template name as shown in the image below. And it has
an anchor tag that checks for the availability of the name entered by the user
highlighted in a green oval as shown in the image below.
In this example, user needs to fire a rest to check the availability of the name.
Usage:
Select the REST API, user needs to fire when user clicks the Check Availability option as shown in the image below.
If user click the “Open Editor” button, it will open the code editor.
There is some code already written inside the editor, the tool has generated this code. When user selects any REST API, the tool generates the required code to execute that REST API. However, in some cases, there is need to do some additional operation on the data, fetched from the server. Therefore, for this purpose, there is a support for code editor, to let user write its own code. In such scenarios, use the response (highlighted in red circle in the image above) for further processing.
Whenever user clicks this option, it will execute the block of code written inside the editor.
- User want to create an invoice. On clicking Create New Invoice
button, navigate should be to the form of creating an invoice.
Usage: In this example user do not need to fire any REST API, user will not select any REST API.
Click the “Open Editor” button, and write code inside the editor as shown in the image below.
Function has two parameters event and data. User can use these parameters in code if required.
Note:
As there is no REST API selected, there will be no auto-generated code.
Parent topic: Available Attributes






