7 Chain REST APIs
User is expected to chain the REST APIs, if the REST APIs are to be called parallel or sequentially. To chain the APIs, the user must select ‘Yes’ option in the previous screen. Once the user selects ‘Yes’, a panel appears on the left having list of selected REST APIs.
To start chaining, user needs to drag the APIs and drop it in the chaining section shown in the middle section of the screen.
Once the user has dropped the REST APIs in the middle section, a right panel gets opened where user has to provide information about the REST type and if the RESTs are parallel independent or dependent.
Some common terms used in chaining are:
- Parent – If this option is selected then, every service call flow needs a parent rest, which will be called first.
- Child - If this option is selected then, service to be called after parent call finishes.
- Parallel Independent – On selecting this option, service calls can be fired independently.
- Parallel Dependent – On selecting this option, service calls logic, which depend on response of an immediate parallel service call, those immediate service calls needs to be parallel dependent
The chaining structure is similar to tree structure. The top most node would be parent and the other nodes would be child nodes.
If user selects REST type as Parent then the node with letter P will be generated.
If user selects REST type as Child then the node with letter C will be generated.
Consider an example if two REST APIs are to be called in a sequential manner.
The first API to be called will be declared as Parent and since no other API is to be called along with this API, it will be parallel independent.
The second API which is to be called after the response of the first API is received, will be declared as a child and parallel independent.
To establish the linkage between the parent and its child nodes and distinguish them from each other, the connection has to be made. To make a connection, drag the child REST from the chaining section, and drop it on the Parent REST and then drag the child node down, the connection will be made.
The connection is only to be established if the services are to be called in sequential manner.
In case, all the services are to be called together and the wait till response of each service has been received, connection will be not established as they all act as parent nodes. In such case, all REST APIs will be configured as parent node and will be parallel dependent since they will have to wait for the response of the selected APIs.
If out of the selected RESTs, some of them are sequential or parallel Dependent and rest of them are parallel Independent, the chaining is still to be performed. To declare a REST to be independent of other rests, select the rest type as Parent and Parallel independent and do not make any connections with those RESTs. Incase all the REST APIs are independent of each other then there is no need of chaining.
If user wants to call the REST APIs as soon as the screen loads, the option ‘Yes’ needs to be selected.
Once the yes option is selected, the REST Chains will be shown to user. In case of independent RESTs their name will appear.
If there is a sequential rest then it will be displayed as
If there is a parallel dependent chain then it will be displayed with their names together
User can select which REST chains he wants to call when the screen loads. Once he has selected the chains, user needs to click on generate init function to generate the code to fire the services on the screen load.
Once the function is generated user can click on Edit Init Function link to edit the code to perform desired actions.
User can perform find, find previous, replace all and jump to line on the code editor.













