...
Possible Integration Points to Invoke Restful API Call
...
Method 1 - Post Form Submission Processing and JSON Tool
By using Post Form Submission Processing in Form, and "Method 1 JSON Call" earlier, this is the easiest and quickest method. This allows us to invoke any Process Tool & Post Form Submission Processing Plugin. JSON Tool is one such candidate.
...
- Upon form submission, form fields will be validated, with its form data stored, then, the "Post Form Submission Processing" will be triggered.
- Response time of form submission will now include complete execution of the JSON Tool.
- Imagine that the external JSON API takes longer than expected to respond, the end user will be kept waiting.
Depending on the feature of the API call, we would assume that it would return a response to indicate successful execution. For example:-
Code Block language js title Sample JSON Call Response { "success" : "true" }
- By using this integration point, there's no way to redirect the user to other place/menu when error occurs..
This is to sum things up so far.
SummaryPoint 1 - Post Form Submission Processing + Method 1 - JSON Call | |
---|---|
Pros |
|
Cons |
|
Read on to see how we can improve.
Point 2 - Workflow Process
...
Method 2 - Post Form Submission Processing and JSON Tool with Multi Tools
To avoid the waiting time for JSON Tool to finish executing, we can place it under Multi Tools instead.
Figure 10
Set the "Run Mode" such that it would execute the process tool (JSON Tool) in a new thread.
Summary | |
---|---|
Pros |
|
Cons |
|
Method 3 - Workflow Process with
With what we have learned so far, there's still 1 con that we are trying to solve. Let's try to put the form within a process flow in a diagram as below.
Figure 11
By using a process flow, we can check the content of the returned JSON call to see if it matches the intended content. For example, we are expecting this reply and have it mapped to a workflow variable.
Code Block | ||||
---|---|---|---|---|
| ||||
{ "success" : "true" } |
By doing so, we would be able to redirect back to the same form again and prompting the end user to submit the form again. The potential customer (end user) may not be able to complete the submission process when the external API is not reliable and sees the same form repetitively. This would lead to confusing UI presentation and frustrating user experience.
Summary | |
---|---|
Pros |
|
Cons |
|