Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Visitor would request for demo by submitting a form in the Joget app.
  2. Upon submission of the form, fields will be validated to make sure that all mandatory fields are filled up.
  3. Upon successful validation of data, the form data will be shared with external system (i.e. CRM software) for further processing through the use plugins (i.e. JSON Tool) or Bean Shell code such as the sample:-

    Code Block
    languagejava
    titleBean Shell code to make restful API calls sample
    linenumberstrue
    import org.apache.http.HttpResponse;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.client.methods.HttpRequestBase;
    import org.apache.http.impl.client.CloseableHttpClient;
    import org.apache.http.impl.client.HttpClients;
    import java.io.IOException;
    import org.joget.commons.util.LogUtil;
    
    try{
    	String jsonUrl = "http://sample.joget.com/api";
    	String name = "header1";
    	String value = "value1";
    
    	CloseableHttpClient client = null;
    	CloseableHttpClient client = HttpClients.createDefault();
    
    	HttpRequestBase request = null;
    	request = new HttpGet(jsonUrl);
    	request.setHeader(name, value);
    
    	HttpResponse response = client.execute(request);
    
    } catch (Exception ex) {
        LogUtil.error(getClass().getName(), ex, "");
    } finally {
        try {
            if (request != null) {
                request.releaseConnection();
            }
            if (client != null) {
                client.close();
            }
        } catch (IOException ex) {
            LogUtil.error(getClass().getName(), ex, "");
        }
    }
  4. The main objective is to ensure successful delivery of data with the external system.

...