10.37 REST API Chain and Hook Function

Example:
  1. 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.

  2. 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.