Batch API
You can use the Batch API to produce multiple interactive communications from a template. The template is an interactive communication without any data. The Batch API combines data with a template to produce an interactive communication. The API is useful in the mass production of interactive communications. For example, telephone bills, credit card statements for multiple customers.
Learn more on Batch Generation API
This article provides sample assets to generate Interactive Communications documents using Batch API.
Batch Generation using Watched Folder
- Import the Interactive Communication template into your AEM Forms server.
- Import the watched folder configuration. This will create a folder called
batchAPI
in your C drive.
If you are running AEM Forms on non-windows operating system, please follow the 3 steps mentioned below:
- Open watched folder
- Select BatchAPIWatchedFolder and click Edit.
- Change the Path to match your operating system.
-
Download and extract the contents of zip file. The zip file contains folder named
jsonfile
which containsbeneficiaries.json
file. This file has the data to generate 3 documents. -
Drop the
jsonfile
folder into the input folder of your watched folder. -
Once the folder is picked up for processing, check the result folder of your watched folder. You should see 3 PDF files generated
Batch Generation using REST Requests
You can invoke the Batch API through REST requests. You can expose REST endpoints for other applications to invoke the API to generate documents.
The sample assets provided exposes REST endpoint for generating Interactive Communication documents. The servlet accepts the following parameters:
- fileName - Location of the data file on the file system.
- templatePath - IC template path
- saveLocation - Location to save the generated documents on the file system
- channelType - Print,Web or both
- recordId - JSON path to element to set name of an interactive communication
The following screenshot shows the parameters and its values
Deploy sample assets on your server
- Import ICTemplate using package manager
- Import Custom Submit handler using package manager
- Import Adaptive Form using the Forms and Document interface
- Deploy and start Custom OSGI bundle using Felix web console
- Trigger Batch Generation by submitting the form