API integration
The app provides an API that can be used for integrations with external services and systems, allowing for automatic import of journals and documents using the configured templates.
The API has the following parameters:
- Publisher: memento
- API Group: importTemplate
- Version: v1.0
- Entity: importTemplates
The API can be called using the following syntax:
https://api.businesscentral.dynamics.com/v2.0/[ENVIRONMENT]/api/memento/importTemplate/v1.0/companies([COMPANY ID])/importTemplates
The body of the request should contain the following fields:
- importCode: Required. The name of the import template to be used.
- fileName: Required. The name of the file to be imported. If this field is not filled in, the request will not be processed.
- base64FileContent: Required. The file content in Base64 format, in the format expected by the selected template.
- templateName: Required for journal imports, to select the journal template where the journal lines should be imported.
- batchName: Required for journal imports, to select the batch where the journal lines should be imported.
- importParameters: Optional. If the import template is configured to accept import parameters for the fields, this should be filled with an array of objects with the following structure: tableId: the id of the table this parameter refers to. fieldId: the id of the field this parameter refers to. fieldValue: the value that should be applied to the parameter. Example of a parameter object:[{"tableId":"81","fieldId":"5","fieldValue":01/01/2024}].
The response will contain a result field indicating the outcome of the import operation and the number of documents or journal lines created:
Power Automate
The API can be used to easly integrate through Power Automate, some examples are:
- Import from a FTP\SFTP server when a new file has been uploaded.
- Import from an on premise file share, using Azure File Shares, when a new file has been created.
- Import from an Azure Blob Storage Account, when a new file has been created.
- Import from an email attachment, when a new email has been received.
In the Business Central connector, the Power Automate action to select is Create Record (V3), using the API parameters:
In the action parameters the call request fields should be filled as previously described:
An example for reading files from an FTP server would be as follows:
Using the files read from the FTP as parameters for the request: