Integration of docusuit_ Document Generation engine: Strong Integration

docusuit_ provides two differents api keys. The form API key is the one which docusuit_ provides for each form. The other kind of API key is the master API key that docusuit_ provides to one user and one domain in user manage section.

Sometimes we do not just need to bring the web forms to our website but we can also make direct use of another info stored in our docusuit_ database.

In that case it is recommendable to carry out a “strong integration”.

This may sound as considerably more complex process but we will see that, again, a few lines of code will do.

Before getting into the details we would like to stress that this strong integration does not require that the website where the web forms are to be integrated is developed in PHP. This is so because all the integration with docusuit_ is encapsulated via a very simple API that has versions in PHP, JSP and ASP so the integration is platform independent.

By the time being, we can carry out two different kind of actions:

  • Direct integration of web forms into the code.
  • Get different type of listings: documents filter by date, category, user, etcetera.

Of course, any seasoned programmer may develop his/her own methods to extract any information of the docusuit_ databases. The purpose of these scripts is to simplify the process for the more standard procedures.

Strong integration of web forms

Its use is extremely simple:

PHP

                                            <?php
                                            include("path_to_script/legaldocx.php");
                                            $legaldocx = new legaldocx();
                                            echo $legaldocx->getWebForm('FORM API KEY');
                                            ?>
                                        

The method getWebForm has 2 parameters, api key(Required) and form_id(Optional). If you use 2 parameters, the api key has to be "the master apikey", otherwise has to be the form api key.

                                            echo $legaldocx->getWebForm('MASTER API KEY', form_id);
                                        

Where legaldocx.php is a script that may be found in your docusuit_ installation in the folder api_resources/php and in the getWebForm method you should include the API Key of the corresponding web form. This method returns the corresponding web form as a string… as simple as that.

JAVA

                                            <%@ page language="java" import="com.legaldocx.*"%>
                                            <%! com.legaldocx.getLegaldocx form = new com.legaldocx.getLegaldocx(); %>
                                            <%= form.getLegaldocxForm('FORM API KEY')  %>
                                        

If you dont have the form api key o you prefer to use the master api key, you have to provide the form id as second parameter(optional) as:

                                            <%= form.getWebForm("11d38898a9023bfec7c3af710e7b7067ce48db52", 3) %>
                                        

Again all the required classes and methods may be found in the folder api_resources/jsp.

ASP

                                            <!--#include   file="Legaldocx.asp"-->
                                            <%
                                            set legaldocx = new Legaldocx
                                            legaldocx.getForm “FORM API KEY”
                                            %>
                                        

As classic asp does not have overloading, docusuit_ provide another method to get the form from the master api key and the form id legaldox.getWebFormId "MASTER API KEY", 3

The corresponding classes and methods can be found in an analogous way to the example above in the folder api_resources/asp.

Listings

As previously commented the strong integration allows us to have further access to the information stored in docusuit_.

We have developed some classes and methods in PHP, JSP and ASP to simplify this process.

One may get, for example, the listings of all templates associated with a master API key (associated univocally to a docusuit_ user and web domain and not to a single web form).

docusuit_ returns a string with some delimiters (that may be customized):

  • $#$ to separate the template names
  • #@# to separate the form API key from the list of templates

Let us now go to over the required procedure for the different script languages under current consideration (PHP, JAVA and ASP).

All the required scripts can be found in the folder “api_resources” of your docusuit_ installation.

PHP

One should call the getTemplatesList method that accepts the following parameters:

  • (string) Master API key(requiered))
  • (array) options:
    • (string) category: filters by the category name.
    • (string) searchTerm: to filter the templates by name.
    • (string) date1: filters data by date (starting date).
    • (string) date2: filters data by date (ending date).
    • (string) url: destination URL for the listed web forms.
    • (string) placeholder1: custom delimiter to separate template names.
    • (string) placeholder2: custom delimiter to separate template names from API key.

This method returns a template list in HTML format.

Example of use:

                                            <?php 
                                            //include the library 
                                            include("legaldocx.php"); 
                                            //get instance from the class legaldocx 
                                            $legaldocx = new legaldocx(); 
                                            //show the templates in a list 
                                            echo $legaldocx->getTemplatesList('dca41daddb6326fc9dfbc403a1f4b2ed2f8e8ea3', array('category' => 'Do', 'searchTerm' => 'pru', 'date1' => '2011-11-22', 'date2' => '2012-10-03', 'url' => 'example_show_form.php')); 
                                            ?>
                                        

JSP

Its use is quite similar to the one above. One should call the method public String getTemplatesList(String apiKey, String[] placeHolder, HashMap options) where the placeHolder and options parameters are optional:

  • (String) Master API key
  • (Array) placeHolder: where the first entry corresponds to the custom delimiter among templates and the second one to the delimiter between the template list and the API key.
  • (HashMap) options:
    • (string) category: filters by the category name.
    • (string) searchTerm: to filter the templates by name.
    • (string) date1: filters data by date (starting date).
    • (string) date2: filters data by date (ending date).
    • (string) url: destination URL for the listed web forms.

Example of use:

                                            <%@ page language="java" import="com.legaldocx.*"%>
                                            <%@ page language="java" import="java.util.*"%> 
                                            <%! com.legaldocx.Legaldocx form = new com.legaldocx.Legaldocx(); %> 
                                            <!-- prepare the filter to use --> 
                                            <% String[] placeHolder = new String[2]; 
                                              placeHolder[0] = ".-."; 
                                              placeHolder[1] = "-.-"; 
                                            %> 
                                            <% 
                                              HashMap<String, String> attributes = new HashMap<String, String>(); 
                                              options.put("category", "Do"); 
                                              options.put("searchTerm", "pru"); 
                                              options.put("date1", "2011-11-22"); 
                                              options.put("date2", "2012-11-23"); 
                                              options.put("url", "example_show_form.jsp"); 
                                            %> 
                                            <!-- get the templates of a specific API key y some filters--> 
                                            <%= form.getTemplatesList("11d38898a9023bfec7c3af710e7b7067ce48db52", placeHolder, attributes) %>
                                        

ASP

One should again call the getTemplatesList method that accepts the following parameters:

  • (string) Master API key
  • (array) options:
    • (string) category: filters by the category name.
    • (string) searchTerm: to filter the templates by name.
    • (string) date1: filters data by date (starting date).
    • (string) date2: filters data by date (ending date).
    • (string) url: destination URL for the listed web forms.
    • (string) placeholder1: custom delimiter to separate template names.
    • (string) placeholder2: custom delimiter to separate template names from API key.

This method returns a template list in HTML format.

Example of use:

                                            <!--#include file="Legaldocx.asp"-->
                                            <% 
                                              Set legaldox = new Legaldocx 
                                              Set options = Server.CreateObject("Scripting.Dictionary") 
                                              options.Add "category", "Do" 
                                              options.Add "searchTerm", "pru" 
                                              options.Add "date1", "2012-10-04" 
                                              options.Add "date2", "2013-10-03" 
                                              options.Add "placeHolder1", "-.-" 
                                              options.Add "placeHolder2", ".-." 
                                              options.Add "url", "yourfile.asp" 
                                              legaldox.getTemplatesList "5c54bc139e4eca198b05712203a902295583d194", options
                                            %>