You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 8
Next »
Follow the below steps inorder to trigger an external API within DBSync mapping
Create a workflow and place them as the last sequence among all the workflow. So that the trigger is initiated after completion of all the workflow.
.
- In Query Builder, select a datasource such as database and read only one record by limiting it to 1.
Example:select * from sku_to_qb_relation limit 1
- Under Rules add console adapter as Target connector, Operation as insert and Console as Target object
- Click map and within out field add a Java code to trigger external API.
Example: {String location="https://712c08e0.ngrok.io/appcenter/login";try{java.net.HttpURLConnection c=(java.net.HttpURLConnection)new java.net.URL(location).openConnection();c.setRequestMethod("GET");if(c.getResponseCode()==200){return new java.io.BufferedReader(new java.io.InputStreamReader(c.getInputStream())).lines().collect(java.util.stream.Collectors.joining());}}catch(java.io.IOException e){e.printStackTrace();}return "GET request did not worked";}
- Save & Close and click Save Workflow
- Run Now and check output within console.