top of page

CDI Blog

I’ve Got an Idea - Writing an API Integration and Where to Begin


By Kyle Knebel



December 2022 Consultants Corner

As a Laserfiche Administrator who wants to begin writing your own custom integration with a 3rd party application to Laserfiche products, where do you start? An API stands for “application programming interface,” where two or more computer programs communicate with each other.


As of Nov. 2022, you can use the Laserfiche SDK or the API to interact with Laserfiche and 3rd party software. The SDK is used when building a “compiled code” project. It includes code libraries that can be referenced, and they ease the burden of connecting to a Laserfiche server. Your SDK license includes documentation regarding libraries, methods, types, and some examples to get you started.


Laserfiche integrations can be built using either the SDK to create a compiled executable program that can be installed on workstations or an API (new as of November 2022).



SDK:

Any functions you might find in the Laserfiche Windows client, for example, can be recreated programmatically with the SDK. For example, CDI has created integrations with CRM systems and in those programs, they have functions like creating a folder or renaming a folder in the Laserfiche repository based on data found in the CRM. So, when the integration needs to create a folder or apply metadata to an entry in the repository, the API will do that work for us. An application built with the Laserfiche SDK has stricter rules about how to connect to a repository and what data can be sent, and in what format.



API:

Unlike a compiled code project with SDK dependencies, API connections are more generic and use web calls (using JSON) as a way to make a connection to your Laserfiche API end point and then to your repository. Less coding is needed since it makes calls to an end-point URL using standards HTTP Web calls like GET and PUT. Previous to November 2022 you could only send an API request to Laserfiche Cloud repositories. Now you can also make an API connection to a self-hosted Repository end point. It uses industry standard REST communication protocols and syntax. It does have its own rules for how to communicate to a Laserfiche repository, however. The API does include How-To guides, examples, and libraries.


Here is an example:





Could I just write some script and add it to Workflow? what else could I do?

Workflow has two script-related activities, “SDK Script” and “Script.”




SDK Script – assumes you want to communicate with the LF Repository specifically and already have the reference to the repository listed.



Script – Allows .Net functions without interacting with the Laserfiche Repository specifically, although you can add this into the code if you want.


Could I add JavaScript to Laserfiche Forms?


Yes, you can use JavaScript in any form in any process. It can respond to user actions, as well as perform calculations on fields and columns of table data. It can be used to run lookup rules on fields already pre-populated. It can validate the information in required fields and much more.


Laserfiche Forms 10.4 and above has several design templates, including one specifically for JavaScript, which can be found when you open the Forms Designer and select Design Patterns from the Business Process Library.




I hope this article whets your appetite for discovering how to use advanced programming in Laserfiche products. Maybe the gift of the Laserfiche SDK is coming to you this holiday season?


Happy Holidays to you!






CDI NEWSLETTER

Stay up to date with all the latest Laserfiche news, CDI webinars, blogs, and more!